Client¶
- class pydelfini.delfini_core.client.Client(base_url, *, raise_on_unexpected_status=False, cookies=NOTHING, headers=NOTHING, timeout=None, verify_ssl=True, follow_redirects=False, httpx_args=NOTHING)[source]¶
Bases:
object
A class for keeping track of data related to the API
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
base_url
: The base URL for the API, all requests are made to a relative path to this URLcookies
: A dictionary of cookies to be sent with every requestheaders
: A dictionary of headers to be sent with every requesttimeout
: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if this is exceeded.verify_ssl
: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes.follow_redirects
: Whether or not to follow redirects. Default value is False.httpx_args
: A dictionary of additional arguments to be passed to thehttpx.Client
andhttpx.AsyncClient
constructor.- Parameters:
- raise_on_unexpected_status¶
Whether or not to raise an errors.UnexpectedStatus if the API returns a status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.
- Type:
Attributes
- get_async_httpx_client()[source]¶
Get the underlying httpx.AsyncClient, constructing a new one if not previously set
- Return type:
AsyncClient
- get_httpx_client()[source]¶
Get the underlying httpx.Client, constructing a new one if not previously set
- Return type:
Client
- set_async_httpx_client(async_client)[source]¶
Manually the underlying httpx.AsyncClient
NOTE: This will override any other settings on the client, including cookies, headers, and timeout.
- Parameters:
async_client (AsyncClient)
- Return type:
- set_httpx_client(client)[source]¶
Manually the underlying httpx.Client
NOTE: This will override any other settings on the client, including cookies, headers, and timeout.
- Parameters:
client (Client)
- Return type: