redditwarp.auth.token_obtainment_client_ASYNC#

class redditwarp.auth.token_obtainment_client_ASYNC.TokenObtainmentClient(http: HTTPClient, url: str, client_creds: ClientCredentials, grant: AuthorizationGrant)[source]#

Bases: object

Exchanges an authorisation grant for an OAuth2 token.

http: HTTPClient#
url: str#
client_creds: ClientCredentials#
grant: AuthorizationGrant#
async fetch_data() Mapping[str, Any][source]#

Exchange an authorisation grant for OAuth2 token data.

Makes a POST request to the specified URL (url) with the provided client credentials (client_creds) and authorization grant (grant).

Returns:

A dictionary of OAuth2 token data.

Return type:

Mapping[str, Any]

Raises:
async fetch_token() Token[source]#

Obtain a Token instance.

Makes use of the fetch_data() method to obtain OAuth2 token data and then constructs a Token instance from the obtained data.

Returns:

An instance of the Token class representing the obtained OAuth2 token.

Return type:

Token