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

ENH: Catch RefreshError in _try_credentials() #227

Merged
merged 2 commits into from
Oct 12, 2018
Merged
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions pandas_gbq/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def save_user_account_credentials(credentials, credentials_path):
def _try_credentials(project_id, credentials):
from google.cloud import bigquery
import google.api_core.exceptions
import google.auth.exceptions

if not credentials:
return None
Expand All @@ -310,3 +311,9 @@ def _try_credentials(project_id, credentials):
return credentials
except google.api_core.exceptions.GoogleAPIError:
return None
except google.auth.exceptions.RefreshError:
# Sometimes (such as on Travis) google-auth returns GCE credentials,
# but fetching the token for those credentials doesn't actually work.
# See:
# https://github.com/googleapis/google-auth-library-python/issues/287
return None