sinch.core.ports.http_transport module
- class sinch.core.ports.http_transport.HTTPTransport(sinch)[source]
Bases:
ABCBase class for HTTP transports.
Subclasses implement
sendto perform the raw HTTP call. The publicrequestmethod adds cross-cutting concerns on top: authentication, logging hooks, and automatic token refresh on 401.- abstractmethod send(
- endpoint: HTTPEndpoint,
Execute a single HTTP round-trip and return the response.
Implementations must prepare the request, authenticate, perform the HTTP call, deserialize the response, and return an
HTTPResponse. They should not handle token refresh — that is done byrequest.- Parameters:
endpoint (HTTPEndpoint)
- Return type:
- request(
- endpoint: HTTPEndpoint,
Send a request with automatic OAuth token refresh on 401.
If the server responds with 401 and the token is detected as expired, the token is invalidated and one retry is attempted with a fresh token. A second consecutive 401 is handed straight to the endpoint’s error handler — no further retries.
- Parameters:
endpoint (HTTPEndpoint)
- Return type:
- prepare_request(
- endpoint: HTTPEndpoint,
- Parameters:
endpoint (HTTPEndpoint)
- Return type: