From d7e511c526366d32ce6a2a4b08ac93bf5b17c87e Mon Sep 17 00:00:00 2001 From: joshuasimon-taulia Date: Wed, 12 Aug 2020 12:07:13 -0700 Subject: [PATCH] fix: ignore ~/.netrc entries when authenticating to looker api --- spectacles/client.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spectacles/client.py b/spectacles/client.py index c7652f9e..db94b4d2 100644 --- a/spectacles/client.py +++ b/spectacles/client.py @@ -86,6 +86,7 @@ def authenticate(self) -> None: url = utils.compose_url(self.api_url, path=["login"]) body = {"client_id": self.client_id, "client_secret": self.client_secret} + self.session.auth = NullAuth() # This should not use `self.post` or it will create a recursive loop response = self.session.post(url=url, data=body, timeout=TIMEOUT_SEC) try: @@ -759,3 +760,12 @@ def all_folders(self, project: str) -> List[JsonDict]: result = response.json() return result + + +class NullAuth(requests.auth.AuthBase): + """A custom auth class which ensures requests does not override authorization + headers with netrc file credentials if present. + """ + + def __call__(self, r): + return r