redditwarp.auth.token_obtainment_client_SYNC
#
- class redditwarp.auth.token_obtainment_client_SYNC.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#
- 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:
redditwarp.http.exceptions.StatusCodeException – The response from the server is not a success status code.
ValueError – The response from the server cannot be parsed as JSON.