Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.requests.api Namespace Reference

Functions

 request (method, url, **kwargs)
 
 get (url, params=None, **kwargs)
 
 options (url, **kwargs)
 
 head (url, **kwargs)
 
 post (url, data=None, json=None, **kwargs)
 
 put (url, data=None, **kwargs)
 
 patch (url, data=None, **kwargs)
 
 delete (url, **kwargs)
 

Detailed Description

requests.api
~~~~~~~~~~~~

This module implements the Requests API.

:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.

Function Documentation

◆ delete()

delete (   url,
**  kwargs 
)
Sends a DELETE request.

:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response

Definition at line 148 of file api.py.

148def delete(url, **kwargs):
149 r"""Sends a DELETE request.
150
151 :param url: URL for the new :class:`Request` object.
152 :param \*\*kwargs: Optional arguments that ``request`` takes.
153 :return: :class:`Response <Response>` object
154 :rtype: requests.Response
155 """
156
157 return request("delete", url, **kwargs)

◆ get()

get (   url,
  params = None,
**  kwargs 
)
Sends a GET request.

:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
    in the query string for the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response

Definition at line 62 of file api.py.

62def get(url, params=None, **kwargs):
63 r"""Sends a GET request.
64
65 :param url: URL for the new :class:`Request` object.
66 :param params: (optional) Dictionary, list of tuples or bytes to send
67 in the query string for the :class:`Request`.
68 :param \*\*kwargs: Optional arguments that ``request`` takes.
69 :return: :class:`Response <Response>` object
70 :rtype: requests.Response
71 """
72
73 return request("get", url, params=params, **kwargs)
74
75

◆ head()

head (   url,
**  kwargs 
)
Sends a HEAD request.

:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. If
    `allow_redirects` is not provided, it will be set to `False` (as
    opposed to the default :meth:`request` behavior).
:return: :class:`Response <Response>` object
:rtype: requests.Response

Definition at line 88 of file api.py.

88def head(url, **kwargs):
89 r"""Sends a HEAD request.
90
91 :param url: URL for the new :class:`Request` object.
92 :param \*\*kwargs: Optional arguments that ``request`` takes. If
93 `allow_redirects` is not provided, it will be set to `False` (as
94 opposed to the default :meth:`request` behavior).
95 :return: :class:`Response <Response>` object
96 :rtype: requests.Response
97 """
98
99 kwargs.setdefault("allow_redirects", False)
100 return request("head", url, **kwargs)
101
102
for i

References i.

◆ options()

options (   url,
**  kwargs 
)
Sends an OPTIONS request.

:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response

Definition at line 76 of file api.py.

76def options(url, **kwargs):
77 r"""Sends an OPTIONS request.
78
79 :param url: URL for the new :class:`Request` object.
80 :param \*\*kwargs: Optional arguments that ``request`` takes.
81 :return: :class:`Response <Response>` object
82 :rtype: requests.Response
83 """
84
85 return request("options", url, **kwargs)
86
87

◆ patch()

patch (   url,
  data = None,
**  kwargs 
)
Sends a PATCH request.

: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) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response

Definition at line 133 of file api.py.

133def patch(url, data=None, **kwargs):
134 r"""Sends a PATCH request.
135
136 :param url: URL for the new :class:`Request` object.
137 :param data: (optional) Dictionary, list of tuples, bytes, or file-like
138 object to send in the body of the :class:`Request`.
139 :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
140 :param \*\*kwargs: Optional arguments that ``request`` takes.
141 :return: :class:`Response <Response>` object
142 :rtype: requests.Response
143 """
144
145 return request("patch", url, data=data, **kwargs)
146
147

◆ post()

post (   url,
  data = None,
  json = None,
**  kwargs 
)
Sends a POST request.

: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) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response

Definition at line 103 of file api.py.

103def post(url, data=None, json=None, **kwargs):
104 r"""Sends a POST request.
105
106 :param url: URL for the new :class:`Request` object.
107 :param data: (optional) Dictionary, list of tuples, bytes, or file-like
108 object to send in the body of the :class:`Request`.
109 :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
110 :param \*\*kwargs: Optional arguments that ``request`` takes.
111 :return: :class:`Response <Response>` object
112 :rtype: requests.Response
113 """
114
115 return request("post", url, data=data, json=json, **kwargs)
116
117

◆ put()

put (   url,
  data = None,
**  kwargs 
)
Sends a PUT request.

: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) A JSON serializable Python object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response

Definition at line 118 of file api.py.

118def put(url, data=None, **kwargs):
119 r"""Sends a PUT request.
120
121 :param url: URL for the new :class:`Request` object.
122 :param data: (optional) Dictionary, list of tuples, bytes, or file-like
123 object to send in the body of the :class:`Request`.
124 :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
125 :param \*\*kwargs: Optional arguments that ``request`` takes.
126 :return: :class:`Response <Response>` object
127 :rtype: requests.Response
128 """
129
130 return request("put", url, data=data, **kwargs)
131
132

◆ request()

request (   method,
  url,
**  kwargs 
)
Constructs and sends a :class:`Request <Request>`.

:param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary, list of tuples or bytes to send
    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) A JSON serializable Python object 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 ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
    ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
    or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
    defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
    to add for the file.
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) How many seconds 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) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
: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``.
:param stream: (optional) if ``False``, the response content will be immediately downloaded.
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
:return: :class:`Response <Response>` object
:rtype: requests.Response

Usage::

  >>> import requests
  >>> req = requests.request('GET', 'https://httpbin.org/get')
  >>> req
  <Response [200]>

Definition at line 14 of file api.py.

14def request(method, url, **kwargs):
15 """Constructs and sends a :class:`Request <Request>`.
16
17 :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.
18 :param url: URL for the new :class:`Request` object.
19 :param params: (optional) Dictionary, list of tuples or bytes to send
20 in the query string for the :class:`Request`.
21 :param data: (optional) Dictionary, list of tuples, bytes, or file-like
22 object to send in the body of the :class:`Request`.
23 :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`.
24 :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
25 :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
26 :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
27 ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
28 or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
29 defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
30 to add for the file.
31 :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
32 :param timeout: (optional) How many seconds to wait for the server to send data
33 before giving up, as a float, or a :ref:`(connect timeout, read
34 timeout) <timeouts>` tuple.
35 :type timeout: float or tuple
36 :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``.
37 :type allow_redirects: bool
38 :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
39 :param verify: (optional) Either a boolean, in which case it controls whether we verify
40 the server's TLS certificate, or a string, in which case it must be a path
41 to a CA bundle to use. Defaults to ``True``.
42 :param stream: (optional) if ``False``, the response content will be immediately downloaded.
43 :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
44 :return: :class:`Response <Response>` object
45 :rtype: requests.Response
46
47 Usage::
48
49 >>> import requests
50 >>> req = requests.request('GET', 'https://httpbin.org/get')
51 >>> req
52 <Response [200]>
53 """
54
55 # By using the 'with' statement we are sure the session is closed, thus we
56 # avoid leaving sockets open which can trigger a ResourceWarning in some
57 # cases, and look like a memory leak in others.
58 with sessions.Session() as session:
59 return session.request(method=method, url=url, **kwargs)
60
61

References i.