-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trim pydata-google-auth package and add tests (#3)
Trim pydata-google-auth package and add tests This is the initial version of the proposed pydata-google-auth package (to be used by pandas-gbq and ibis). It includes two methods: * `pydata_google_auth.default()` * A function that does the same as pandas-gbq does auth currently. Tries `google.auth.default()` and then falls back to user credentials. * `pydata_google_auth.get_user_credentials()` * A public `get_user_credentials()` function, as proposed in googleapis/python-bigquery-pandas#161. Missing in this implementation is a more configurable way to adjust credentials caching. I currently use the `reauth` logic from pandas-gbq. I drop `try_credentials()`, as it makes less sense when this module might be used for other APIs besides BigQuery. Plus there were problems with `try_credentials()` even for pandas-gbq (googleapis/python-bigquery-pandas#202, googleapis/python-bigquery-pandas#198).
- Loading branch information
Showing
6 changed files
with
151 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
from .auth import default # noqa | ||
|
||
from .auth import default | ||
from .auth import get_user_credentials | ||
from ._version import get_versions | ||
|
||
versions = get_versions() | ||
__version__ = versions.get('closest-tag', versions['version']) | ||
__git_revision__ = versions['full-revisionid'] | ||
del get_versions, versions | ||
|
||
"""pydata-google-auth | ||
This package provides helpers for fetching Google API credentials. | ||
""" | ||
|
||
__all__ = [ | ||
'__version__', | ||
'__git_revision__', | ||
'default', | ||
'get_user_credentials', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,6 @@ | ||
|
||
|
||
class AccessDenied(ValueError): | ||
class PyDataCredentialsError(ValueError): | ||
""" | ||
Raised when invalid credentials are provided, or tokens have expired. | ||
""" | ||
pass | ||
|
||
|
||
class InvalidPrivateKeyFormat(ValueError): | ||
""" | ||
Raised when provided private key has invalid format. | ||
""" | ||
pass |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.