options keyword argument that controls per-call timeouts and one-off headers. The same RequestOptions shape works for regular requests and for Server-Sent Events streams.
RequestOptions
RequestOptions is a TypedDict with two optional fields:
Override timeout per call
Usetimeout to set a shorter or longer bound for a single request.
filename.py
30.0 seconds. See Client configuration for setting the default.
Inject one-off headers
Useheaders to add request correlation IDs, feature flags, or override a default value once.
filename.py
Combining options
Pass both fields together when needed:filename.py
Timeout and cancellation semantics
Python does not useAbortSignal. Cancellation is handled by httpx timeouts or by breaking out of a stream iteration.
- When a request exceeds the configured timeout, the SDK raises
FigraniumErrorwithcode="REQUEST_ABORTED". The__cause__property carries the underlyinghttpx.TimeoutException. - When the request cannot reach the server (DNS failure, connection refused, TLS error), the SDK raises
FigraniumErrorwithcode="NETWORK_ERROR". The__cause__property carries the underlyinghttpx.HTTPError.
filename.py
Stream timeouts
Streams have no default timeout. Passoptions={"timeout": 60.0} when you want a terminal deadline. The stream raises FigraniumError(code="REQUEST_ABORTED") when the timer fires.
filename.py