class documentation

A Requests session. Provides cookie persistence, connection-pooling, and configuration. Basic Usage:: >>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') <Response [200]> Or as a context manager:: >>> with requests.Session() as s: ... s.get('https://httpbin.org/get') <Response [200]>

Method __enter__ Undocumented
Method __exit__ Undocumented
Method __getstate__ Undocumented
Method __init__ Undocumented
Method __setstate__ Undocumented
Method close Closes all adapters and as such the session
Method delete Sends a DELETE request. Returns :class:`Response` object.
Method get Sends a GET request. Returns :class:`Response` object.
Method get_adapter Returns the appropriate connection adapter for the given URL.
Method head Sends a HEAD request. Returns :class:`Response` object.
Method merge_environment_settings Check the environment and merge it with some settings.
Method mount Registers a connection adapter to a prefix.
Method options Sends a OPTIONS request. Returns :class:`Response` object.
Method patch Sends a PATCH request. Returns :class:`Response` object.
Method post Sends a POST request. Returns :class:`Response` object.
Method prepare_request Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request <Request>` instance and those of the :class:`Session`.
Method put Sends a PUT request. Returns :class:`Response` object.
Method request Constructs a :class:`Request <Request>`, prepares it and sends it. Returns :class:`Response <Response>` object.
Method send Send a given PreparedRequest.
Class Variable __attrs__ Undocumented
Instance Variable adapters Undocumented
Instance Variable auth Undocumented
Instance Variable cert Undocumented
Instance Variable cookies Undocumented
Instance Variable headers Undocumented
Instance Variable hooks Undocumented
Instance Variable max_redirects Undocumented
Instance Variable params Undocumented
Instance Variable proxies Undocumented
Instance Variable stream Undocumented
Instance Variable trust_env Undocumented
Instance Variable verify Undocumented

Inherited from SessionRedirectMixin:

Method get_redirect_target Receives a Response. Returns a redirect URI or ``None``
Method rebuild_auth When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss.
Method rebuild_method When being redirected we may want to change the method of the request based on certain specs or browser behavior.
Method rebuild_proxies This method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in case they were stripped by a previous redirect).
Method resolve_redirects Receives a Response. Returns a generator of Responses or Requests.
Method should_strip_auth Decide whether Authorization header should be removed when redirecting
def __enter__(self): (source)

Undocumented

def __exit__(self, *args): (source)

Undocumented

def __getstate__(self): (source)

Undocumented

def __init__(self): (source)

Undocumented

def __setstate__(self, state): (source)

Undocumented

def close(self): (source)

Closes all adapters and as such the session

def delete(self, url, **kwargs): (source)

Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response

def get(self, url, **kwargs): (source)

Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response

def get_adapter(self, url): (source)

Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter

def head(self, url, **kwargs): (source)

Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response

def merge_environment_settings(self, url, proxies, stream, verify, cert): (source)

Check the environment and merge it with some settings. :rtype: dict

def mount(self, prefix, adapter): (source)

Registers a connection adapter to a prefix. Adapters are sorted in descending order by prefix length.

def options(self, url, **kwargs): (source)

Sends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response

def patch(self, url, data=None, **kwargs): (source)

Sends a PATCH request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response

def post(self, url, data=None, json=None, **kwargs): (source)

Sends a POST request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response

def prepare_request(self, request): (source)

Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request <Request>` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this session's settings. :rtype: requests.PreparedRequest

def put(self, url, data=None, **kwargs): (source)

Sends a PUT request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response

def request(self, method, url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=None, allow_redirects=True, proxies=None, hooks=None, stream=None, verify=None, cert=None, json=None): (source)

Constructs a :class:`Request <Request>`, prepares it and sends it. Returns :class:`Response <Response>` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param data: (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'filename': file-like-objects`` for multipart encoding upload. :param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) <timeouts>` tuple. :type timeout: float or tuple :param allow_redirects: (optional) Set to True by default. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol or protocol and hostname to the URL of the proxy. :param stream: (optional) whether to immediately download the response content. Defaults to ``False``. :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. When set to ``False``, requests will accept any TLS certificate presented by the server, and will ignore hostname mismatches and/or expired certificates, which will make your application vulnerable to man-in-the-middle (MitM) attacks. Setting verify to ``False`` may be useful during local development or testing. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :rtype: requests.Response

def send(self, request, **kwargs): (source)

Send a given PreparedRequest. :rtype: requests.Response

__attrs__: list[str] = (source)

Undocumented

adapters = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

max_redirects = (source)

Undocumented

Undocumented

Undocumented

Undocumented

trust_env: bool = (source)

Undocumented

Undocumented