|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self) |
| def | __enter__ (self) |
| def | __exit__ (self, *args) |
| def | prepare_request (self, request) |
| 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) |
| def | get (self, url, **kwargs) |
| def | options (self, url, **kwargs) |
| def | head (self, url, **kwargs) |
| def | post (self, url, data=None, json=None, **kwargs) |
| def | put (self, url, data=None, **kwargs) |
| def | patch (self, url, data=None, **kwargs) |
| def | delete (self, url, **kwargs) |
| def | send (self, request, **kwargs) |
| def | merge_environment_settings (self, url, proxies, stream, verify, cert) |
| def | get_adapter (self, url) |
| def | close (self) |
| def | mount (self, prefix, adapter) |
| def | __getstate__ (self) |
| def | __setstate__ (self, state) |
Public Member Functions inherited from SessionRedirectMixin | |
| def | get_redirect_target (self, resp) |
| def | should_strip_auth (self, old_url, new_url) |
| def | resolve_redirects (self, resp, req, stream=False, timeout=None, verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs) |
| def | rebuild_auth (self, prepared_request, response) |
| def | rebuild_proxies (self, prepared_request, proxies) |
| def | rebuild_method (self, prepared_request, response) |
Data Fields | |
| headers | |
| auth | |
| proxies | |
| hooks | |
| params | |
| stream | |
| verify | |
| cert | |
| max_redirects | |
| trust_env | |
| cookies | |
| adapters | |
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]>
| def __init__ | ( | self | ) |
| def __enter__ | ( | self | ) |
| def __exit__ | ( | self, | |
| * | args | ||
| ) |
| def __getstate__ | ( | self | ) |
| def __setstate__ | ( | self, | |
| state | |||
| ) |
| def close | ( | self | ) |
Closes all adapters and as such the session
| def delete | ( | self, | |
| url, | |||
| ** | kwargs | ||
| ) |
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 | ||
| ) |
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 | |||
| ) |
Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter
| def head | ( | self, | |
| url, | |||
| ** | kwargs | ||
| ) |
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 | |||
| ) |
Check the environment and merge it with some settings. :rtype: dict
| def mount | ( | self, | |
| prefix, | |||
| adapter | |||
| ) |
Registers a connection adapter to a prefix. Adapters are sorted in descending order by prefix length.
| def options | ( | self, | |
| url, | |||
| ** | kwargs | ||
| ) |
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 | ||
| ) |
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 | ||
| ) |
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 | |||
| ) |
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 | ||
| ) |
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 |
|||
| ) |
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 | ||
| ) |
Send a given PreparedRequest. :rtype: requests.Response
| adapters |
| auth |
| cert |
| cookies |
| headers |
| hooks |
| max_redirects |
| params |
| proxies |
| stream |
| trust_env |
| verify |