gamesheet_sdk.common.shared.gamesheet_http module¶
HTTP response handling utilities.
- gamesheet_sdk.common.shared.gamesheet_http.handle_response(response, endpoint, context_msg='request')[source]¶
Centralized HTTP error handling for all domain modules.
- Parameters:
response (requests.Response) – The HTTP response object.
endpoint (str) – The endpoint that was called.
context_msg (str) – Context message for error reporting (e.g.,
"GET associations").
- Raises:
AuthenticationError – If response status is 401 (Unauthorized).
GameSheetPermissionError – If response status is 403 (Forbidden).
GameSheetNotFoundError – If response status is 404 (Not Found).
GameSheetRateLimitError – If response status is 429 (Too Many Requests).
GameSheetAPIError – For any other >= 400 response status.
- gamesheet_sdk.common.shared.gamesheet_http.check_bff_response_status(data, _endpoint)[source]¶
Validate BFF API response status field.
BFF API responses include a
"status"field that should be"success".- Parameters:
- Raises:
GameSheetError – If status is not
"success".
- gamesheet_sdk.common.shared.gamesheet_http.handle_season_scoped_response(response, endpoint, season_id, method='GET', resource_type='season')[source]¶
Handle HTTP errors for season-scoped API calls.
Provides season-specific error messages for common failures.
- Parameters:
response (requests.Response) – The HTTP response object.
endpoint (str) – The endpoint that was called.
season_id (str) – The season ID used in the request.
method (str) – The HTTP verb (GET, POST, PATCH, DELETE).
resource_type (str) – Type of resource being accessed (e.g. “season”, “referee”).
- Raises:
AuthenticationError – If response status is 401 (Unauthorized).
GameSheetPermissionError – If response status is 403 (Forbidden).
GameSheetNotFoundError – If response status is 404 (Not Found).
GameSheetAPIError – For any other >= 400 response status.