Skip to content

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 case google.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 to None, in which case a new 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).

__call__

__call__() -> GCSCredential

Fetch the credentials.

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 case google.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 to None, in which case a new google.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).

__call__ async

__call__() -> GCSCredential

Fetch the credentials.