Skip to main content

synth_ai.core.http

HTTP client utilities for Synth AI SDK. This module provides async HTTP client functionality used by SDK modules for communicating with the Synth backend.

Functions

sleep

sleep(seconds: float) -> None
Async sleep helper.

http_request

http_request(method: str, url: str, headers: dict[str, str] | None = None, body: dict[str, Any] | None = None) -> tuple[int, dict[str, Any] | str]
Synchronous HTTP request using stdlib. Args:
  • method: HTTP method (GET, POST, etc.)
  • url: Full URL to request
  • headers: Optional headers dict
  • body: Optional JSON body dict
Returns:
  • Tuple of (status_code, response_data)

Classes

AsyncHttpClient

Async HTTP client for Synth API calls. Methods:

get

get(self, path: str) -> Any
Make a GET request.

post_json

post_json(self, path: str) -> Any
Make a POST request with JSON body.

post_multipart

post_multipart(self, path: str) -> Any
Make a POST request with multipart form data.

delete

delete(self, path: str) -> Any
Make a DELETE request.