trust_api.utils.http
Functions
|
Utility function to help make HTTP requests to external APIs. |
Module Contents
- async trust_api.utils.http.make_request(method: str, url: str, *, json_body: dict | None = None, params: dict | None = None, headers: dict | None = None, timeout_seconds: float = 30.0, follow_redirects: bool = True) dict[str, Any]
Utility function to help make HTTP requests to external APIs.
- Parameters:
method (str) – HTTP method (GET, POST, etc.)
url (str) – URL of the external API
json_body (dict | None) – Request body content
params (dict | None) – Query parameters for the request
headers (dict | None) – Headers for the request
timeout_seconds (float) – Timeout for the request in seconds
follow_redirects (bool) – Whether to follow redirects
- Returns:
JSON response from the external API
- Return type:
dict[str, Any]
- Raises:
HTTPException – If there is an error during the request or if the response is not JSON