Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore ~/.netrc entries when authenticating to looker api #281

Merged
merged 1 commit into from
Aug 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions spectacles/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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