diff options
author | Shubham Saini <shubham6405@gmail.com> | 2019-08-05 08:32:33 +0000 |
---|---|---|
committer | Shubham Saini <shubham6405@gmail.com> | 2019-08-05 08:32:33 +0000 |
commit | 227b2d30a8675b44918f9d9ca89b24144a938215 (patch) | |
tree | 9f8e6a28724514b6fdf463a9ab2067a7ef309b72 /venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/api.py | |
parent | 842a8cfbbbdb1f92889d892e4859dbd5d40c5be8 (diff) |
removing venv files
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/api.py')
-rw-r--r-- | venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/api.py | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/api.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/api.py deleted file mode 100644 index f9ffabf..0000000 --- a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/api.py +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | # -*- coding: utf-8 -*- | ||
2 | |||
3 | """ | ||
4 | requests.api | ||
5 | ~~~~~~~~~~~~ | ||
6 | |||
7 | This module implements the Requests API. | ||
8 | |||
9 | :copyright: (c) 2012 by Kenneth Reitz. | ||
10 | :license: Apache2, see LICENSE for more details. | ||
11 | """ | ||
12 | |||
13 | from . import sessions | ||
14 | |||
15 | |||
16 | def request(method, url, **kwargs): | ||
17 | """Constructs and sends a :class:`Request <Request>`. | ||
18 | |||
19 | :param method: method for the new :class:`Request` object. | ||
20 | :param url: URL for the new :class:`Request` object. | ||
21 | :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. | ||
22 | :param data: (optional) Dictionary or list of tuples ``[(key, value)]`` (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`. | ||
23 | :param json: (optional) json data 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', 'http://httpbin.org/get') | ||
51 | <Response [200]> | ||
52 | """ | ||
53 | |||
54 | # By using the 'with' statement we are sure the session is closed, thus we | ||
55 | # avoid leaving sockets open which can trigger a ResourceWarning in some | ||
56 | # cases, and look like a memory leak in others. | ||
57 | with sessions.Session() as session: | ||
58 | return session.request(method=method, url=url, **kwargs) | ||
59 | |||
60 | |||
61 | def get(url, params=None, **kwargs): | ||
62 | r"""Sends a GET request. | ||
63 | |||
64 | :param url: URL for the new :class:`Request` object. | ||
65 | :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. | ||
66 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
67 | :return: :class:`Response <Response>` object | ||
68 | :rtype: requests.Response | ||
69 | """ | ||
70 | |||
71 | kwargs.setdefault('allow_redirects', True) | ||
72 | return request('get', url, params=params, **kwargs) | ||
73 | |||
74 | |||
75 | def options(url, **kwargs): | ||
76 | r"""Sends an OPTIONS request. | ||
77 | |||
78 | :param url: URL for the new :class:`Request` object. | ||
79 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
80 | :return: :class:`Response <Response>` object | ||
81 | :rtype: requests.Response | ||
82 | """ | ||
83 | |||
84 | kwargs.setdefault('allow_redirects', True) | ||
85 | return request('options', url, **kwargs) | ||
86 | |||
87 | |||
88 | def 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. | ||
93 | :return: :class:`Response <Response>` object | ||
94 | :rtype: requests.Response | ||
95 | """ | ||
96 | |||
97 | kwargs.setdefault('allow_redirects', False) | ||
98 | return request('head', url, **kwargs) | ||
99 | |||
100 | |||
101 | def post(url, data=None, json=None, **kwargs): | ||
102 | r"""Sends a POST request. | ||
103 | |||
104 | :param url: URL for the new :class:`Request` object. | ||
105 | :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`. | ||
106 | :param json: (optional) json data to send in the body of the :class:`Request`. | ||
107 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
108 | :return: :class:`Response <Response>` object | ||
109 | :rtype: requests.Response | ||
110 | """ | ||
111 | |||
112 | return request('post', url, data=data, json=json, **kwargs) | ||
113 | |||
114 | |||
115 | def put(url, data=None, **kwargs): | ||
116 | r"""Sends a PUT request. | ||
117 | |||
118 | :param url: URL for the new :class:`Request` object. | ||
119 | :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`. | ||
120 | :param json: (optional) json data to send in the body of the :class:`Request`. | ||
121 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
122 | :return: :class:`Response <Response>` object | ||
123 | :rtype: requests.Response | ||
124 | """ | ||
125 | |||
126 | return request('put', url, data=data, **kwargs) | ||
127 | |||
128 | |||
129 | def patch(url, data=None, **kwargs): | ||
130 | r"""Sends a PATCH request. | ||
131 | |||
132 | :param url: URL for the new :class:`Request` object. | ||
133 | :param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`. | ||
134 | :param json: (optional) json data to send in the body of the :class:`Request`. | ||
135 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
136 | :return: :class:`Response <Response>` object | ||
137 | :rtype: requests.Response | ||
138 | """ | ||
139 | |||
140 | return request('patch', url, data=data, **kwargs) | ||
141 | |||
142 | |||
143 | def delete(url, **kwargs): | ||
144 | r"""Sends a DELETE request. | ||
145 | |||
146 | :param url: URL for the new :class:`Request` object. | ||
147 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
148 | :return: :class:`Response <Response>` object | ||
149 | :rtype: requests.Response | ||
150 | """ | ||
151 | |||
152 | return request('delete', url, **kwargs) | ||