class documentation

class BaseClient:

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 ​_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):

Undocumented

Parameters
auth:AuthTypesUndocumented
params:QueryParamTypesUndocumented
headers:HeaderTypesUndocumented
cookies:CookieTypesUndocumented
timeout:TimeoutTypesUndocumented
follow​_redirects:boolUndocumented
max​_redirects:intUndocumented
event​_hooks:typing.Mapping[str, typing.List[typing.Callable]]Undocumented
base​_url:URLTypesUndocumented
trust​_env:boolUndocumented
@auth.setter
def auth(self, auth):

Undocumented

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

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):

Build and return a request instance.

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:RequestContentUndocumented
data:RequestDataUndocumented
files:RequestFilesUndocumented
json:typing.AnyUndocumented
params:QueryParamTypesUndocumented
headers:HeaderTypesUndocumented
cookies:CookieTypesUndocumented
timeout:typing.Union[TimeoutTypes, UseClientDefault]Undocumented
extensions:dictUndocumented
Returns
RequestUndocumented
@cookies.setter
def cookies(self, cookies):

Undocumented

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

Undocumented

Parameters
event​_hooks:typing.Dict[str, typing.List[typing.Callable]]Undocumented
@headers.setter
def headers(self, headers):

Undocumented

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

Undocumented

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

Undocumented

Parameters
timeout:TimeoutTypesUndocumented
follow_redirects =

Undocumented

max_redirects =

Undocumented

@property
auth: typing.Optional[Auth] =

Authentication class used when none is passed at the request-level.

See also [Authentication][0].

[0]: /quickstart/#authentication

@property
base_url: URL =
Base URL to use when sending requests with relative URLs.
@property
cookies: Cookies =
Cookie values to include when sending requests.
@property
event_hooks: typing.Dict[str, typing.List[typing.Callable]] =

Undocumented

@property
headers: Headers =
HTTP headers to include when sending requests.
@property
is_closed: bool =
Check if the client being closed
@property
params: QueryParams =
Query parameters to include in the URL when sending requests.
@property
timeout: Timeout =

Undocumented

@property
trust_env: bool =

Undocumented

def _build_auth(self, auth):

Undocumented

Parameters
auth:AuthTypesUndocumented
Returns
typing.Optional[Auth]Undocumented
def _build_redirect_request(self, request, response):
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):

Undocumented

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

Undocumented

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

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):
Merge a cookies argument together with any cookies on the client, to create the cookies used for the outgoing request.
Parameters
cookies:CookieTypesUndocumented
Returns
typing.Optional[CookieTypes]Undocumented
def _merge_headers(self, headers=None):
Merge a headers argument together with any headers on the client, to create the headers used for the outgoing request.
Parameters
headers:HeaderTypesUndocumented
Returns
typing.Optional[HeaderTypes]Undocumented
def _merge_queryparams(self, params=None):
Merge a queryparams argument together with any queryparams on the client, to create the queryparams used for the outgoing request.
Parameters
params:QueryParamTypesUndocumented
Returns
typing.Optional[QueryParamTypes]Undocumented
def _merge_url(self, url):
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):
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):
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):
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):
Return the URL for the redirect to follow.
Parameters
request:RequestUndocumented
response:ResponseUndocumented
Returns
URLUndocumented
_auth =

Undocumented

_base_url =

Undocumented

_cookies =

Undocumented

_event_hooks =

Undocumented

_headers =

Undocumented

_netrc =

Undocumented

_params =

Undocumented

_state =

Undocumented

_timeout =

Undocumented

_trust_env =

Undocumented