class documentation

class BaseClient: (source)

Known subclasses: httpx.AsyncClient, httpx.Client

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method auth.setter Undocumented
Method base_url.setter Undocumented
Method build_request Build and return a request instance.
Method cookies.setter Undocumented
Method event_hooks.setter Undocumented
Method headers.setter Undocumented
Method params.setter Undocumented
Method timeout.setter Undocumented
Instance Variable follow_redirects Undocumented
Instance Variable max_redirects Undocumented
Property auth Authentication class used when none is passed at the request-level.
Property base_url Base URL to use when sending requests with relative URLs.
Property cookies Cookie values to include when sending requests.
Property event_hooks Undocumented
Property headers HTTP headers to include when sending requests.
Property is_closed Check if the client being closed
Property params Query parameters to include in the URL when sending requests.
Property timeout Undocumented
Property trust_env Undocumented
Method _build_auth Undocumented
Method _build_redirect_request Given a request and a redirect response, return a new request that should be used to effect the redirect.
Method _build_request_auth Undocumented
Method _enforce_trailing_slash Undocumented
Method _get_proxy_map Undocumented
Method _merge_cookies Merge a cookies argument together with any cookies on the client, to create the cookies used for the outgoing request.
Method _merge_headers Merge a headers argument together with any headers on the client, to create the headers used for the outgoing request.
Method _merge_queryparams Merge a queryparams argument together with any queryparams on the client, to create the queryparams used for the outgoing request.
Method _merge_url Merge a URL argument together with any 'base_url' on the client, to create the URL used for the outgoing request.
Method _redirect_headers Return the headers that should be used for the redirect request.
Method _redirect_method When being redirected we may want to change the method of the request based on certain specs or browser behavior.
Method _redirect_stream Return the body that should be used for the redirect request.
Method _redirect_url Return the URL for the redirect to follow.
Instance Variable _auth Undocumented
Instance Variable _base_url Undocumented
Instance Variable _cookies Undocumented
Instance Variable _default_encoding Undocumented
Instance Variable _event_hooks Undocumented
Instance Variable _headers Undocumented
Instance Variable _netrc Undocumented
Instance Variable _params Undocumented
Instance Variable _state Undocumented
Instance Variable _timeout Undocumented
Instance Variable _trust_env Undocumented
def __init__(self, *, auth=None, params=None, headers=None, cookies=None, timeout=DEFAULT_TIMEOUT_CONFIG, follow_redirects=False, max_redirects=DEFAULT_MAX_REDIRECTS, event_hooks=None, base_url='', trust_env=True, default_encoding='utf-8'): (source)

Undocumented

Parameters
auth:typing.Optional[AuthTypes]Undocumented
params:typing.Optional[QueryParamTypes]Undocumented
headers:typing.Optional[HeaderTypes]Undocumented
cookies:typing.Optional[CookieTypes]Undocumented
timeout:TimeoutTypesUndocumented
follow_redirects:boolUndocumented
max_redirects:intUndocumented
event_hooks:typing.Optional[typing.Mapping[str, typing.List[EventHook]]]Undocumented
base_url:URLTypesUndocumented
trust_env:boolUndocumented
default_encoding:typing.Union[str, typing.Callable[[bytes], str]]Undocumented
@auth.setter
def auth(self, auth): (source)

Undocumented

Parameters
auth:AuthTypesUndocumented
@base_url.setter
def base_url(self, url): (source)

Undocumented

Parameters
url:URLTypesUndocumented
def build_request(self, method, url, *, content=None, data=None, files=None, json=None, params=None, headers=None, cookies=None, timeout=USE_CLIENT_DEFAULT, extensions=None): (source)

Build and return a request instance. * The `params`, `headers` and `cookies` arguments are merged with any values set on the client. * The `url` argument is merged with any `base_url` set on the client. See also: [Request instances][0] [0]: /advanced/#request-instances

Parameters
method:strUndocumented
url:URLTypesUndocumented
content:typing.Optional[RequestContent]Undocumented
data:typing.Optional[RequestData]Undocumented
files:typing.Optional[RequestFiles]Undocumented
json:typing.Optional[typing.Any]Undocumented
params:typing.Optional[QueryParamTypes]Undocumented
headers:typing.Optional[HeaderTypes]Undocumented
cookies:typing.Optional[CookieTypes]Undocumented
timeout:typing.Union[TimeoutTypes, UseClientDefault]Undocumented
extensions:typing.Optional[RequestExtensions]Undocumented
Returns
RequestUndocumented
@cookies.setter
def cookies(self, cookies): (source)

Undocumented

Parameters
cookies:CookieTypesUndocumented
@event_hooks.setter
def event_hooks(self, event_hooks): (source)

Undocumented

Parameters
event_hooks:typing.Dict[str, typing.List[EventHook]]Undocumented
@headers.setter
def headers(self, headers): (source)

Undocumented

Parameters
headers:HeaderTypesUndocumented
@params.setter
def params(self, params): (source)

Undocumented

Parameters
params:QueryParamTypesUndocumented
@timeout.setter
def timeout(self, timeout): (source)

Undocumented

Parameters
timeout:TimeoutTypesUndocumented
follow_redirects = (source)

Undocumented

max_redirects = (source)

Undocumented

Authentication class used when none is passed at the request-level. See also [Authentication][0]. [0]: /quickstart/#authentication

@property
base_url: URL = (source)

Base URL to use when sending requests with relative URLs.

@property
cookies: Cookies = (source)

Cookie values to include when sending requests.

@property
headers: Headers = (source)

HTTP headers to include when sending requests.

Check if the client being closed

@property
params: QueryParams = (source)

Query parameters to include in the URL when sending requests.

@property
timeout: Timeout = (source)

Undocumented

Undocumented

def _build_auth(self, auth): (source)

Undocumented

Parameters
auth:typing.Optional[AuthTypes]Undocumented
Returns
typing.Optional[Auth]Undocumented
def _build_redirect_request(self, request, response): (source)

Given a request and a redirect response, return a new request that should be used to effect the redirect.

Parameters
request:RequestUndocumented
response:ResponseUndocumented
Returns
RequestUndocumented
def _build_request_auth(self, request, auth=USE_CLIENT_DEFAULT): (source)

Undocumented

Parameters
request:RequestUndocumented
auth:typing.Union[AuthTypes, UseClientDefault, None]Undocumented
Returns
AuthUndocumented
def _enforce_trailing_slash(self, url): (source)

Undocumented

Parameters
url:URLUndocumented
Returns
URLUndocumented
def _get_proxy_map(self, proxies, allow_env_proxies): (source)

Undocumented

Parameters
proxies:typing.Optional[ProxiesTypes]Undocumented
allow_env_proxies:boolUndocumented
Returns
typing.Dict[str, typing.Optional[Proxy]]Undocumented
def _merge_cookies(self, cookies=None): (source)

Merge a cookies argument together with any cookies on the client, to create the cookies used for the outgoing request.

Parameters
cookies:typing.Optional[CookieTypes]Undocumented
Returns
typing.Optional[CookieTypes]Undocumented
def _merge_headers(self, headers=None): (source)

Merge a headers argument together with any headers on the client, to create the headers used for the outgoing request.

Parameters
headers:typing.Optional[HeaderTypes]Undocumented
Returns
typing.Optional[HeaderTypes]Undocumented
def _merge_queryparams(self, params=None): (source)

Merge a queryparams argument together with any queryparams on the client, to create the queryparams used for the outgoing request.

Parameters
params:typing.Optional[QueryParamTypes]Undocumented
Returns
typing.Optional[QueryParamTypes]Undocumented
def _merge_url(self, url): (source)

Merge a URL argument together with any 'base_url' on the client, to create the URL used for the outgoing request.

Parameters
url:URLTypesUndocumented
Returns
URLUndocumented
def _redirect_headers(self, request, url, method): (source)

Return the headers that should be used for the redirect request.

Parameters
request:RequestUndocumented
url:URLUndocumented
method:strUndocumented
Returns
HeadersUndocumented
def _redirect_method(self, request, response): (source)

When being redirected we may want to change the method of the request based on certain specs or browser behavior.

Parameters
request:RequestUndocumented
response:ResponseUndocumented
Returns
strUndocumented
def _redirect_stream(self, request, method): (source)

Return the body that should be used for the redirect request.

Parameters
request:RequestUndocumented
method:strUndocumented
Returns
typing.Optional[typing.Union[SyncByteStream, AsyncByteStream]]Undocumented
def _redirect_url(self, request, response): (source)

Return the URL for the redirect to follow.

Parameters
request:RequestUndocumented
response:ResponseUndocumented
Returns
URLUndocumented

Undocumented

_base_url = (source)

Undocumented

_cookies = (source)

Undocumented

_default_encoding = (source)

Undocumented

_event_hooks = (source)

Undocumented

_headers = (source)

Undocumented

Undocumented

Undocumented

Undocumented

_timeout = (source)

Undocumented

_trust_env = (source)

Undocumented