secrets#

class analytix.secrets.Secrets(client_id: str, project_id: str, auth_uri: str, token_uri: str, auth_provider_x509_cert_url: str, client_secret: str, redirect_uris: list[str])#

A dataclass representing a set of secrets for a Google Developers project. This should generally be created using one of the available classmethods.

Parameters
  • client_id – The client ID.

  • project_id – The name of the project.

  • auth_uri – The authorisation server endpoint URI.

  • token_uri – The token server endpoint URI.

  • auth_provider_x509_cert_url – The URL of the public x509 certificate, used to verify the signature on JWTs, such as ID tokens, signed by the authentication provider.

  • client_secret – The client secret.

  • redirect_uris – A list of valid redirection endpoint URIs. This list should match the list entered for the client ID on the API Access pane of the Google APIs Console.

classmethod from_file(path: pathlib.Path | str) Secrets#

Load a set of secrets from a file downloaded from the Google Developers Console.

Parameters

path – The path to the secrets file.

Returns

The loaded secrets.

async classmethod afrom_file(path: pathlib.Path | str) Secrets#

Asynchronously load a set of secrets from a file downloaded from the Google Developers Console.

Parameters

path – The path to the secrets file.

Returns

The loaded secrets.

to_dict() dict[str, SecretT]#

Convert secrets to a dictionary.

Returns

A dictionary of secrets, where the keys are strings, and the values are either strings or lists of strings.