unofficial_tabdeal_api.base¶
This module holds the BaseClass.
Classes¶
This is the base class, stores GET and POST functions. |
Module Contents¶
- class unofficial_tabdeal_api.base.BaseClass(*, user_hash, authorization_key, _is_test=False)¶
This is the base class, stores GET and POST functions.
- _client_session: aiohttp.ClientSession¶
- _logger: logging.Logger¶
- async close()¶
Close the aiohttp client session.
- Return type:
None
- async __aenter__()¶
Enter the async context manager.
- Return type:
Self
- async __aexit__(exc_type, exc, tb)¶
Exit the async context manager and close the session.
- Parameters:
exc_type (type[BaseException] | None)
exc (BaseException | None)
tb (types.TracebackType | None)
- Return type:
None
- async _get_data_from_server(*, connection_url, queries=None)¶
Gets data from specified url and returns the parsed json back.
- async _post_data_to_server(*, connection_url, data)¶
Posts data to specified url and returns the result of request.
- async _check_response(response)¶
Check the server response and raise appropriate exception in case of an error.
- Parameters:
response (ClientResponse) – Response from server
- Raises:
AuthorizationError – Raised when the authorization key is invalid or expired
Error – Raised for all other errors
- Return type:
None
- _raise_specific_error(status_code, server_response)¶
Raise a specific exception based on the server response content.
- Parameters:
- Raises:
exc_class – The specific exception class to raise
RequestError – Raised for all other errors
- Return type:
None