ratings_client
Definitions to help interact with the Ratings API.
RatingsAPIClient
Bases: GenericHordeAPIManualClient
Represent a client specifically configured for the Ratings APi.
Source code in horde_sdk/ratings_api/ratings_client.py
__init__
should_retry
Determine if a request should be retried based on the status code and retry configuration.
Parameters:
-
status_code(int) –The HTTP status code returned by the request.
-
current_error_count(int) –The current number of errors encountered.
-
retry_after(float) –The time to wait before retrying the request.
Returns:
-
bool(bool) –True if the request should be retried, False otherwise.
Source code in horde_sdk/generic_api/generic_clients.py
submit_request
submit_request(
api_request: HordeRequest,
expected_response_type: type[HordeResponseTypeVar],
) -> HordeResponseTypeVar | RequestErrorResponse
Submit a request to the API and return the response.
If you are wondering why expected_response_type is a parameter, it is because the API may return different
responses depending on the payload or other factors. It is up to you to determine which response type you
expect, and pass it in here.
Parameters:
-
api_request(HordeRequest) –The request to submit.
-
expected_response_type(type[HordeResponse]) –The expected response type.
Returns:
-
HordeResponseTypeVar | RequestErrorResponse–HordeResponseTypeVar | RequestErrorResponse: The response from the API.