Skip to content

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)

__call__

__call__() -> GCSCredential

Fetch the credentials.

__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 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).

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)

__call__ async

__call__() -> GCSCredential

Fetch the credentials.

__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 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).