SlyAPI.service_account#

Classes

OAuth2ServiceAccount(account, scopes)

Google Cloud service account

ServiceAccount(client_email, client_id, ...)

Used to acquire grants for Google Cloud service accounts

ServiceGrant(access_token, expires_at, ...)

Temporary (hours to days), secret value used to sign requests

class SlyAPI.service_account.ServiceGrant(access_token, expires_at, token_type)[source]#

Bases: object

Temporary (hours to days), secret value used to sign requests

Parameters:
  • access_token (str) –

  • expires_at (datetime) –

  • token_type (str) –

access_token: str#
expires_at: datetime#
token_type: str#
class SlyAPI.service_account.ServiceAccount(client_email, client_id, private_key, auth_uri, token_uri)[source]#

Bases: object

Used to acquire grants for Google Cloud service accounts

Parameters:
  • client_email (str) –

  • client_id (str) –

  • private_key (str) –

  • auth_uri (str) –

  • token_uri (str) –

client_email: str#
client_id: str#
private_key: str#
auth_uri: str#
token_uri: str#
await grant(client, scopes)[source]#
Parameters:
  • client (ClientSession) –

  • scopes (list[str]) –

Return type:

ServiceGrant

classmethod from_json_obj(obj)[source]#

Create from a JSON object in the Google Console JSON format

Parameters:

obj (dict[str, int | float | bool | str | None | list['JsonType'] | dict[str, 'JsonType']]) –

Return type:

ServiceAccount

classmethod from_json_file(path)[source]#

Create from a JSON file path

Parameters:

path (str) –

Return type:

ServiceAccount

class SlyAPI.service_account.OAuth2ServiceAccount(account, scopes)[source]#

Bases: Auth

Google Cloud service account

Parameters:
account: ServiceAccount#
scopes: list[str]#
await sign(client, request)[source]#
Parameters:
  • client (ClientSession) –

  • request (Request) –

Return type:

Request