Google Auth¶
obstore.auth.google.GoogleAuthCredentialProvider ¶
A CredentialProvider for GCSStore that uses google.auth.
This credential provider uses google-auth and requests, and will error if those
cannot be imported.
Example:
from obstore.auth.google import GoogleAuthCredentialProvider
from obstore.store import GCSStore
credential_provider = GoogleAuthCredentialProvider(credentials=...)
store = GCSStore("bucket_name", credential_provider=credential_provider)
__init__ ¶
__init__(
credentials: Credentials | None = None,
*,
request: Request | None = None,
refresh_threshold: timedelta = timedelta(minutes=3, seconds=45),
) -> None
Create a new GoogleAuthCredentialProvider.
Parameters:
-
credentials(Credentials | None, default:None) –Credentials to use for this provider. Defaults to
None, in which casegoogle.auth.defaultwill be called to find application default credentials.
Other Parameters:
-
request(Request | None) –The Request instance to use for refreshing the token. This can be set to reuse an existing
requests.Session. Defaults toNone, in which case a newRequestwill be instantiated. -
refresh_threshold(timedelta) –The length of time before the token timeout when a new token should be requested. Defaults to
timedelta(minutes=3, seconds=45)(suggested here).
obstore.auth.google.GoogleAuthAsyncCredentialProvider ¶
An async CredentialProvider for GCSStore that uses google.auth.
This credential provider should be preferred over the synchronous GoogleAuthCredentialProvider whenever you're using async obstore methods.
This credential provider uses google-auth and aiohttp, and will error if those
cannot be imported.
Example:
from obstore.auth.google import GoogleAuthAsyncCredentialProvider
from obstore.store import GCSStore
credential_provider = GoogleAuthAsyncCredentialProvider(credentials=...)
store = GCSStore("bucket_name", credential_provider=credential_provider)
__init__ ¶
__init__(
credentials: Credentials | None = None,
*,
request: Request | None = None,
refresh_threshold: timedelta = timedelta(minutes=3, seconds=45),
) -> None
Create a new GoogleAuthCredentialProvider.
Parameters:
-
credentials(Credentials | None, default:None) –Credentials to use for this provider. Defaults to
None, in which casegoogle.auth._default_async.default_asyncwill be called to find application default credentials.
Other Parameters:
-
request(Request | None) –The Request instance to use for refreshing the token. This can be set to reuse an existing
aiohttp.ClientSession. Defaults toNone, in which case a newgoogle.auth.transport._aiohttp_requests.Requestwill be instantiated. -
refresh_threshold(timedelta) –The length of time before the token timeout when a new token should be requested. Defaults to
timedelta(minutes=3, seconds=45)(suggested here).