obelisk.asynchronous.client.Client

class obelisk.asynchronous.client.Client(client: str, secret: str, retry_strategy: ~obelisk.strategies.retry.RetryStrategy = <obelisk.strategies.retry.NoRetryStrategy object>, kind: ~obelisk.types.ObeliskKind = ObeliskKind.CLASSIC)[source]

Bases: object

Base class handling Obelisk auth and doing the core HTTP communication. Only exists in asynchronous variety, as it is not usually directly useful for user code.

Attributes:
token
token_expires

Methods

http_post(url[, data, params])

Send an HTTP POST request to Obelisk, with proper auth.

__init__(client: str, secret: str, retry_strategy: ~obelisk.strategies.retry.RetryStrategy = <obelisk.strategies.retry.NoRetryStrategy object>, kind: ~obelisk.types.ObeliskKind = ObeliskKind.CLASSIC) None[source]

Methods

__init__(client, secret[, retry_strategy, kind])

http_post(url[, data, params])

Send an HTTP POST request to Obelisk, with proper auth.

Attributes

grace_period

Controls how much before the expiration deadline a token will be refreshed.

token

Current authentication token

token_expires

Deadline after which token is no longer useable

retry_strategy

kind

log

grace_period: timedelta = datetime.timedelta(seconds=10)

Controls how much before the expiration deadline a token will be refreshed.

async http_post(url: str, data: Any = None, params: dict | None = None) Response[source]

Send an HTTP POST request to Obelisk, with proper auth.

Possibly refreshes the authentication token and performs backoff as per retry_strategy. This method is not of stable latency because of these properties.

No validation is performed on the input data, callers are responsible for formatting it in a method Obelisk understands.

token: str | None = None

Current authentication token

token_expires: datetime | None = None

Deadline after which token is no longer useable