Google¶
obstore.auth.google.GoogleCredentialProvider ¶
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 GoogleCredentialProvider
from obstore.store import GCSStore
credential_provider = GoogleCredentialProvider(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 GoogleCredentialProvider.
Parameters:
-
credentials
(Credentials | None
, default:None
) –Credentials to use for this provider. Defaults to
None
, in which casegoogle.auth.default
will 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 newRequest
will 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.GoogleAsyncCredentialProvider ¶
An async CredentialProvider for GCSStore that uses google.auth
.
This credential provider should be preferred over the synchronous GoogleCredentialProvider 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 GoogleAsyncCredentialProvider
from obstore.store import GCSStore
credential_provider = GoogleAsyncCredentialProvider(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 GoogleCredentialProvider.
Parameters:
-
credentials
(Credentials | None
, default:None
) –Credentials to use for this provider. Defaults to
None
, in which casegoogle.auth._default_async.default_async
will 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.Request
will 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).