Session#
- class fitrequest.session.Session(client_name: str, version: str, auth: Auth | dict | None = None, base_url: str | None = None, headers: dict | None = None, **kwargs)[source]#
Bases:
object- async async_request(method_config: MethodConfig, raise_for_status: bool | None = None, filepath: str | None = None, **kwargs) Any[source]#
Async version of the request method.
- asynchronous: AsyncClient#
- authenticate() None[source]#
Retrieve the necessary data for authentication and configure the auth attribute for both synchronous and asynchronous clients.
- request(method_config: MethodConfig, raise_for_status: bool | None = None, filepath: str | None = None, **kwargs) Any[source]#
Sends a request to a URL created based on the provided MethodConfig.
Any keyword arguments (kwargs) you provide will be used as named variables to build the final URL, and some of these kwargs are also passed directly to the httpx.request method.
You can optionally supply a custom URL, which will take priority over the generated one. If a custom URL with hardcoded parameters is provided along with the argument “params” (in kwargs), both sets of parameters are combined, giving priority to those in the custom URL over the ones in “params.”
- synchronous: Client#
- update(client_name: str | None = None, version: str | None = None, auth: Auth | dict | None = None, base_url: str | None = None, headers: dict | None = None, **kwargs) None[source]#
Update the session used by generated methods.
It effectively drops the existing synchronous and asynchronous sessions and creates a new ones using the specified arguments.
Additional keyword arguments are passed directly to the
httpxclients during initialization.This method does not trigger a new authentication process. If you need to perform a new authentication, use the
authenticatemethod.