Merge lp:~zulcss/ubuntu/precise/requests/requests-ca into lp:ubuntu/precise/requests
- Precise (12.04)
- requests-ca
- Merge into precise
Status: | Superseded |
---|---|
Proposed branch: | lp:~zulcss/ubuntu/precise/requests/requests-ca |
Merge into: | lp:ubuntu/precise/requests |
Diff against target: |
26464 lines (+21254/-3087) 115 files modified
.pc/.quilt_patches (+1/-0) .pc/.quilt_series (+1/-0) .pc/.version (+1/-0) .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/connectionpool.py (+562/-0) .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/filepost.py (+91/-0) .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/response.py (+202/-0) .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/util.py (+252/-0) .pc/03-use-distro-packages.patch/requests/adapters.py (+58/-0) .pc/03-use-distro-packages.patch/requests/compat.py (+119/-0) .pc/03-use-distro-packages.patch/requests/models.py (+907/-0) .pc/03-use-distro-packages.patch/requests/packages/__init__.py (+3/-0) .pc/03-use-distro-packages.patch/requests/safe_mode.py (+40/-0) .pc/03-use-distro-packages.patch/requests/sessions.py (+328/-0) .pc/03-use-distro-packages.patch/setup.py (+73/-0) .pc/applied-patches (+2/-0) HISTORY.rst (+299/-2) LICENSE (+1/-1) MANIFEST.in (+1/-1) NOTICE (+116/-0) PKG-INFO (+341/-52) README.rst (+21/-45) debian/changelog (+137/-0) debian/control (+38/-23) debian/copyright (+63/-5) debian/patches/02_do-not-use-embedded-python-six.patch (+51/-0) debian/patches/03-use-distro-packages.patch (+127/-0) debian/patches/series (+2/-0) debian/rules (+23/-1) requests.egg-info/PKG-INFO (+341/-52) requests.egg-info/SOURCES.txt (+61/-6) requests/__init__.py (+34/-7) requests/_oauth.py (+23/-0) requests/adapters.py (+58/-0) requests/api.py (+33/-46) requests/async.py (+0/-89) requests/auth.py (+357/-121) requests/cacert.pem (+3338/-0) requests/certs.py (+27/-0) requests/compat.py (+131/-0) requests/cookies.py (+377/-0) requests/defaults.py (+16/-8) requests/exceptions.py (+26/-3) requests/hooks.py (+14/-6) requests/models.py (+512/-240) requests/packages/__init__.py (+1/-1) requests/packages/chardet/__init__.py (+26/-0) requests/packages/chardet/big5freq.py (+923/-0) requests/packages/chardet/big5prober.py (+41/-0) requests/packages/chardet/chardistribution.py (+200/-0) requests/packages/chardet/charsetgroupprober.py (+96/-0) requests/packages/chardet/charsetprober.py (+60/-0) requests/packages/chardet/codingstatemachine.py (+56/-0) requests/packages/chardet/constants.py (+47/-0) requests/packages/chardet/escprober.py (+79/-0) requests/packages/chardet/escsm.py (+240/-0) requests/packages/chardet/eucjpprober.py (+85/-0) requests/packages/chardet/euckrfreq.py (+594/-0) requests/packages/chardet/euckrprober.py (+41/-0) requests/packages/chardet/euctwfreq.py (+426/-0) requests/packages/chardet/euctwprober.py (+41/-0) requests/packages/chardet/gb2312freq.py (+471/-0) requests/packages/chardet/gb2312prober.py (+41/-0) requests/packages/chardet/hebrewprober.py (+269/-0) requests/packages/chardet/jisfreq.py (+567/-0) requests/packages/chardet/jpcntx.py (+210/-0) requests/packages/chardet/langbulgarianmodel.py (+228/-0) requests/packages/chardet/langcyrillicmodel.py (+329/-0) requests/packages/chardet/langgreekmodel.py (+225/-0) requests/packages/chardet/langhebrewmodel.py (+201/-0) requests/packages/chardet/langhungarianmodel.py (+225/-0) requests/packages/chardet/langthaimodel.py (+200/-0) requests/packages/chardet/latin1prober.py (+136/-0) requests/packages/chardet/mbcharsetprober.py (+82/-0) requests/packages/chardet/mbcsgroupprober.py (+50/-0) requests/packages/chardet/mbcssm.py (+514/-0) requests/packages/chardet/sbcharsetprober.py (+106/-0) requests/packages/chardet/sbcsgroupprober.py (+64/-0) requests/packages/chardet/sjisprober.py (+85/-0) requests/packages/chardet/universaldetector.py (+154/-0) requests/packages/chardet/utf8prober.py (+76/-0) requests/packages/oauthlib/common.py (+229/-0) requests/packages/oauthlib/oauth1/__init__.py (+13/-0) requests/packages/oauthlib/oauth1/rfc5849/__init__.py (+889/-0) requests/packages/oauthlib/oauth1/rfc5849/parameters.py (+134/-0) requests/packages/oauthlib/oauth1/rfc5849/signature.py (+551/-0) requests/packages/oauthlib/oauth1/rfc5849/utils.py (+99/-0) requests/packages/oauthlib/oauth2/__init__.py (+13/-0) requests/packages/oauthlib/oauth2/draft25/__init__.py (+497/-0) requests/packages/oauthlib/oauth2/draft25/parameters.py (+256/-0) requests/packages/oauthlib/oauth2/draft25/tokens.py (+132/-0) requests/packages/oauthlib/oauth2/draft25/utils.py (+39/-0) requests/packages/oreos/__init__.py (+0/-3) requests/packages/oreos/core.py (+0/-24) requests/packages/oreos/monkeys.py (+0/-770) requests/packages/oreos/structures.py (+0/-399) requests/packages/urllib3/__init__.py (+26/-16) requests/packages/urllib3/_collections.py (+80/-117) requests/packages/urllib3/connectionpool.py (+187/-150) requests/packages/urllib3/exceptions.py (+55/-13) requests/packages/urllib3/filepost.py (+43/-23) requests/packages/urllib3/packages/__init__.py (+4/-0) requests/packages/urllib3/packages/ordered_dict.py (+260/-0) requests/packages/urllib3/packages/six.py (+372/-0) requests/packages/urllib3/packages/ssl_match_hostname/__init__.py (+61/-0) requests/packages/urllib3/poolmanager.py (+63/-33) requests/packages/urllib3/request.py (+6/-23) requests/packages/urllib3/response.py (+61/-40) requests/packages/urllib3/util.py (+252/-0) requests/safe_mode.py (+40/-0) requests/sessions.py (+109/-60) requests/status_codes.py (+2/-2) requests/structures.py (+4/-3) requests/utils.py (+353/-118) setup.py (+27/-26) test_requests.py (+0/-558) |
To merge this branch: | bzr merge lp:~zulcss/ubuntu/precise/requests/requests-ca |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+145247@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-01-28.
Commit message
Description of the change
Unmerged revisions
- 19. By Chuck Short
-
* New upstream release for the Ubuntu Cloud Archvie:
- Removed python3 version. - 18. By Barry Warsaw
-
* New upstream release (LP: #1076107). Remaining changes:
- debian/patches/ 01_do-not- use-python- certifi. patch: No longer necessary.
- debian/patches/ 02_do-not- use-embedded- python- six.patch: refreshed
- debian/patches/ 03-dont- use-embeded- urllib3. patch: refreshed and
renamed to 03-use-distro- packages. patch
- debian/control: python-chardet and python3-chardet are now required
(i.e. Depends instead of Recommends). - 17. By Dave Walker
-
debian/control: Resolve Depends misspelling of python-urllib3.
- 16. By Adam Conrad
-
* Add -r to rm call in debian/rules removing requests/
packages/ urllib3
* Add python3-urllib3 to build-depends and python3-requests depends - 15. By Chuck Short
-
debian/rules, debian/control,
debian/patches/ 03-dont- use-embeded- urllib3. patch:
Don't use embeded python-urllib3. - 14. By James Page
-
d/{rules,control}: Disable tests and drop associated deps; 10/11
of them require network connectivity so they break in offline build
environments. - 13. By Chuck Short
-
debian/control: Fix up testsuite some more.
- 12. By Chuck Short
-
debia/rules: Enable test suite.
- 11. By Daniele Tricoli
-
* New upstream release
* debian/control
- Added python-oauthlib to python-requests' Recommends field
* debian/patches/ 01_do-not- use-python- certifi. patch
- Refreshed - 10. By Daniele Tricoli
-
* New upstream release
* debian/patches/ 01_do-not- use-python- certifi. patch
- Refreshed
Preview Diff
1 | === added directory '.pc' | |||
2 | === added file '.pc/.quilt_patches' | |||
3 | --- .pc/.quilt_patches 1970-01-01 00:00:00 +0000 | |||
4 | +++ .pc/.quilt_patches 2013-01-28 21:06:46 +0000 | |||
5 | @@ -0,0 +1,1 @@ | |||
6 | 1 | debian/patches | ||
7 | 0 | 2 | ||
8 | === added file '.pc/.quilt_series' | |||
9 | --- .pc/.quilt_series 1970-01-01 00:00:00 +0000 | |||
10 | +++ .pc/.quilt_series 2013-01-28 21:06:46 +0000 | |||
11 | @@ -0,0 +1,1 @@ | |||
12 | 1 | series | ||
13 | 0 | 2 | ||
14 | === added file '.pc/.version' | |||
15 | --- .pc/.version 1970-01-01 00:00:00 +0000 | |||
16 | +++ .pc/.version 2013-01-28 21:06:46 +0000 | |||
17 | @@ -0,0 +1,1 @@ | |||
18 | 1 | 2 | ||
19 | 0 | 2 | ||
20 | === added directory '.pc/02_do-not-use-embedded-python-six.patch' | |||
21 | === added directory '.pc/02_do-not-use-embedded-python-six.patch/requests' | |||
22 | === added directory '.pc/02_do-not-use-embedded-python-six.patch/requests/packages' | |||
23 | === added directory '.pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3' | |||
24 | === added file '.pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/connectionpool.py' | |||
25 | --- .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/connectionpool.py 1970-01-01 00:00:00 +0000 | |||
26 | +++ .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/connectionpool.py 2013-01-28 21:06:46 +0000 | |||
27 | @@ -0,0 +1,562 @@ | |||
28 | 1 | # urllib3/connectionpool.py | ||
29 | 2 | # Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt) | ||
30 | 3 | # | ||
31 | 4 | # This module is part of urllib3 and is released under | ||
32 | 5 | # the MIT License: http://www.opensource.org/licenses/mit-license.php | ||
33 | 6 | |||
34 | 7 | import logging | ||
35 | 8 | import socket | ||
36 | 9 | |||
37 | 10 | from socket import timeout as SocketTimeout | ||
38 | 11 | |||
39 | 12 | try: # Python 3 | ||
40 | 13 | from http.client import HTTPConnection, HTTPException | ||
41 | 14 | from http.client import HTTP_PORT, HTTPS_PORT | ||
42 | 15 | except ImportError: | ||
43 | 16 | from httplib import HTTPConnection, HTTPException | ||
44 | 17 | from httplib import HTTP_PORT, HTTPS_PORT | ||
45 | 18 | |||
46 | 19 | try: # Python 3 | ||
47 | 20 | from queue import LifoQueue, Empty, Full | ||
48 | 21 | except ImportError: | ||
49 | 22 | from Queue import LifoQueue, Empty, Full | ||
50 | 23 | |||
51 | 24 | |||
52 | 25 | try: # Compiled with SSL? | ||
53 | 26 | HTTPSConnection = object | ||
54 | 27 | BaseSSLError = None | ||
55 | 28 | ssl = None | ||
56 | 29 | |||
57 | 30 | try: # Python 3 | ||
58 | 31 | from http.client import HTTPSConnection | ||
59 | 32 | except ImportError: | ||
60 | 33 | from httplib import HTTPSConnection | ||
61 | 34 | |||
62 | 35 | import ssl | ||
63 | 36 | BaseSSLError = ssl.SSLError | ||
64 | 37 | |||
65 | 38 | except (ImportError, AttributeError): # Platform-specific: No SSL. | ||
66 | 39 | pass | ||
67 | 40 | |||
68 | 41 | |||
69 | 42 | from .request import RequestMethods | ||
70 | 43 | from .response import HTTPResponse | ||
71 | 44 | from .util import get_host, is_connection_dropped | ||
72 | 45 | from .exceptions import ( | ||
73 | 46 | ClosedPoolError, | ||
74 | 47 | EmptyPoolError, | ||
75 | 48 | HostChangedError, | ||
76 | 49 | MaxRetryError, | ||
77 | 50 | SSLError, | ||
78 | 51 | TimeoutError, | ||
79 | 52 | ) | ||
80 | 53 | |||
81 | 54 | from .packages.ssl_match_hostname import match_hostname, CertificateError | ||
82 | 55 | from .packages import six | ||
83 | 56 | |||
84 | 57 | |||
85 | 58 | xrange = six.moves.xrange | ||
86 | 59 | |||
87 | 60 | log = logging.getLogger(__name__) | ||
88 | 61 | |||
89 | 62 | _Default = object() | ||
90 | 63 | |||
91 | 64 | port_by_scheme = { | ||
92 | 65 | 'http': HTTP_PORT, | ||
93 | 66 | 'https': HTTPS_PORT, | ||
94 | 67 | } | ||
95 | 68 | |||
96 | 69 | |||
97 | 70 | ## Connection objects (extension of httplib) | ||
98 | 71 | |||
99 | 72 | class VerifiedHTTPSConnection(HTTPSConnection): | ||
100 | 73 | """ | ||
101 | 74 | Based on httplib.HTTPSConnection but wraps the socket with | ||
102 | 75 | SSL certification. | ||
103 | 76 | """ | ||
104 | 77 | cert_reqs = None | ||
105 | 78 | ca_certs = None | ||
106 | 79 | |||
107 | 80 | def set_cert(self, key_file=None, cert_file=None, | ||
108 | 81 | cert_reqs='CERT_NONE', ca_certs=None): | ||
109 | 82 | ssl_req_scheme = { | ||
110 | 83 | 'CERT_NONE': ssl.CERT_NONE, | ||
111 | 84 | 'CERT_OPTIONAL': ssl.CERT_OPTIONAL, | ||
112 | 85 | 'CERT_REQUIRED': ssl.CERT_REQUIRED | ||
113 | 86 | } | ||
114 | 87 | |||
115 | 88 | self.key_file = key_file | ||
116 | 89 | self.cert_file = cert_file | ||
117 | 90 | self.cert_reqs = ssl_req_scheme.get(cert_reqs) or ssl.CERT_NONE | ||
118 | 91 | self.ca_certs = ca_certs | ||
119 | 92 | |||
120 | 93 | def connect(self): | ||
121 | 94 | # Add certificate verification | ||
122 | 95 | sock = socket.create_connection((self.host, self.port), self.timeout) | ||
123 | 96 | |||
124 | 97 | # Wrap socket using verification with the root certs in | ||
125 | 98 | # trusted_root_certs | ||
126 | 99 | self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, | ||
127 | 100 | cert_reqs=self.cert_reqs, | ||
128 | 101 | ca_certs=self.ca_certs) | ||
129 | 102 | if self.ca_certs: | ||
130 | 103 | match_hostname(self.sock.getpeercert(), self.host) | ||
131 | 104 | |||
132 | 105 | |||
133 | 106 | ## Pool objects | ||
134 | 107 | |||
135 | 108 | class ConnectionPool(object): | ||
136 | 109 | """ | ||
137 | 110 | Base class for all connection pools, such as | ||
138 | 111 | :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. | ||
139 | 112 | """ | ||
140 | 113 | |||
141 | 114 | scheme = None | ||
142 | 115 | QueueCls = LifoQueue | ||
143 | 116 | |||
144 | 117 | def __init__(self, host, port=None): | ||
145 | 118 | self.host = host | ||
146 | 119 | self.port = port | ||
147 | 120 | |||
148 | 121 | def __str__(self): | ||
149 | 122 | return '%s(host=%r, port=%r)' % (type(self).__name__, | ||
150 | 123 | self.host, self.port) | ||
151 | 124 | |||
152 | 125 | |||
153 | 126 | class HTTPConnectionPool(ConnectionPool, RequestMethods): | ||
154 | 127 | """ | ||
155 | 128 | Thread-safe connection pool for one host. | ||
156 | 129 | |||
157 | 130 | :param host: | ||
158 | 131 | Host used for this HTTP Connection (e.g. "localhost"), passed into | ||
159 | 132 | :class:`httplib.HTTPConnection`. | ||
160 | 133 | |||
161 | 134 | :param port: | ||
162 | 135 | Port used for this HTTP Connection (None is equivalent to 80), passed | ||
163 | 136 | into :class:`httplib.HTTPConnection`. | ||
164 | 137 | |||
165 | 138 | :param strict: | ||
166 | 139 | Causes BadStatusLine to be raised if the status line can't be parsed | ||
167 | 140 | as a valid HTTP/1.0 or 1.1 status line, passed into | ||
168 | 141 | :class:`httplib.HTTPConnection`. | ||
169 | 142 | |||
170 | 143 | :param timeout: | ||
171 | 144 | Socket timeout for each individual connection, can be a float. None | ||
172 | 145 | disables timeout. | ||
173 | 146 | |||
174 | 147 | :param maxsize: | ||
175 | 148 | Number of connections to save that can be reused. More than 1 is useful | ||
176 | 149 | in multithreaded situations. If ``block`` is set to false, more | ||
177 | 150 | connections will be created but they will not be saved once they've | ||
178 | 151 | been used. | ||
179 | 152 | |||
180 | 153 | :param block: | ||
181 | 154 | If set to True, no more than ``maxsize`` connections will be used at | ||
182 | 155 | a time. When no free connections are available, the call will block | ||
183 | 156 | until a connection has been released. This is a useful side effect for | ||
184 | 157 | particular multithreaded situations where one does not want to use more | ||
185 | 158 | than maxsize connections per host to prevent flooding. | ||
186 | 159 | |||
187 | 160 | :param headers: | ||
188 | 161 | Headers to include with all requests, unless other headers are given | ||
189 | 162 | explicitly. | ||
190 | 163 | """ | ||
191 | 164 | |||
192 | 165 | scheme = 'http' | ||
193 | 166 | |||
194 | 167 | def __init__(self, host, port=None, strict=False, timeout=None, maxsize=1, | ||
195 | 168 | block=False, headers=None): | ||
196 | 169 | super(HTTPConnectionPool, self).__init__(host, port) | ||
197 | 170 | |||
198 | 171 | self.strict = strict | ||
199 | 172 | self.timeout = timeout | ||
200 | 173 | self.pool = self.QueueCls(maxsize) | ||
201 | 174 | self.block = block | ||
202 | 175 | self.headers = headers or {} | ||
203 | 176 | |||
204 | 177 | # Fill the queue up so that doing get() on it will block properly | ||
205 | 178 | for _ in xrange(maxsize): | ||
206 | 179 | self.pool.put(None) | ||
207 | 180 | |||
208 | 181 | # These are mostly for testing and debugging purposes. | ||
209 | 182 | self.num_connections = 0 | ||
210 | 183 | self.num_requests = 0 | ||
211 | 184 | |||
212 | 185 | def _new_conn(self): | ||
213 | 186 | """ | ||
214 | 187 | Return a fresh :class:`httplib.HTTPConnection`. | ||
215 | 188 | """ | ||
216 | 189 | self.num_connections += 1 | ||
217 | 190 | log.info("Starting new HTTP connection (%d): %s" % | ||
218 | 191 | (self.num_connections, self.host)) | ||
219 | 192 | return HTTPConnection(host=self.host, port=self.port) | ||
220 | 193 | |||
221 | 194 | def _get_conn(self, timeout=None): | ||
222 | 195 | """ | ||
223 | 196 | Get a connection. Will return a pooled connection if one is available. | ||
224 | 197 | |||
225 | 198 | If no connections are available and :prop:`.block` is ``False``, then a | ||
226 | 199 | fresh connection is returned. | ||
227 | 200 | |||
228 | 201 | :param timeout: | ||
229 | 202 | Seconds to wait before giving up and raising | ||
230 | 203 | :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and | ||
231 | 204 | :prop:`.block` is ``True``. | ||
232 | 205 | """ | ||
233 | 206 | conn = None | ||
234 | 207 | try: | ||
235 | 208 | conn = self.pool.get(block=self.block, timeout=timeout) | ||
236 | 209 | |||
237 | 210 | except AttributeError: # self.pool is None | ||
238 | 211 | raise ClosedPoolError(self, "Pool is closed.") | ||
239 | 212 | |||
240 | 213 | except Empty: | ||
241 | 214 | if self.block: | ||
242 | 215 | raise EmptyPoolError(self, | ||
243 | 216 | "Pool reached maximum size and no more " | ||
244 | 217 | "connections are allowed.") | ||
245 | 218 | pass # Oh well, we'll create a new connection then | ||
246 | 219 | |||
247 | 220 | # If this is a persistent connection, check if it got disconnected | ||
248 | 221 | if conn and is_connection_dropped(conn): | ||
249 | 222 | log.info("Resetting dropped connection: %s" % self.host) | ||
250 | 223 | conn.close() | ||
251 | 224 | |||
252 | 225 | return conn or self._new_conn() | ||
253 | 226 | |||
254 | 227 | def _put_conn(self, conn): | ||
255 | 228 | """ | ||
256 | 229 | Put a connection back into the pool. | ||
257 | 230 | |||
258 | 231 | :param conn: | ||
259 | 232 | Connection object for the current host and port as returned by | ||
260 | 233 | :meth:`._new_conn` or :meth:`._get_conn`. | ||
261 | 234 | |||
262 | 235 | If the pool is already full, the connection is closed and discarded | ||
263 | 236 | because we exceeded maxsize. If connections are discarded frequently, | ||
264 | 237 | then maxsize should be increased. | ||
265 | 238 | |||
266 | 239 | If the pool is closed, then the connection will be closed and discarded. | ||
267 | 240 | """ | ||
268 | 241 | try: | ||
269 | 242 | self.pool.put(conn, block=False) | ||
270 | 243 | return # Everything is dandy, done. | ||
271 | 244 | except AttributeError: | ||
272 | 245 | # self.pool is None. | ||
273 | 246 | pass | ||
274 | 247 | except Full: | ||
275 | 248 | # This should never happen if self.block == True | ||
276 | 249 | log.warning("HttpConnectionPool is full, discarding connection: %s" | ||
277 | 250 | % self.host) | ||
278 | 251 | |||
279 | 252 | # Connection never got put back into the pool, close it. | ||
280 | 253 | conn.close() | ||
281 | 254 | |||
282 | 255 | def _make_request(self, conn, method, url, timeout=_Default, | ||
283 | 256 | **httplib_request_kw): | ||
284 | 257 | """ | ||
285 | 258 | Perform a request on a given httplib connection object taken from our | ||
286 | 259 | pool. | ||
287 | 260 | """ | ||
288 | 261 | self.num_requests += 1 | ||
289 | 262 | |||
290 | 263 | if timeout is _Default: | ||
291 | 264 | timeout = self.timeout | ||
292 | 265 | |||
293 | 266 | conn.timeout = timeout # This only does anything in Py26+ | ||
294 | 267 | conn.request(method, url, **httplib_request_kw) | ||
295 | 268 | |||
296 | 269 | # Set timeout | ||
297 | 270 | sock = getattr(conn, 'sock', False) # AppEngine doesn't have sock attr. | ||
298 | 271 | if sock: | ||
299 | 272 | sock.settimeout(timeout) | ||
300 | 273 | |||
301 | 274 | try: # Python 2.7+, use buffering of HTTP responses | ||
302 | 275 | httplib_response = conn.getresponse(buffering=True) | ||
303 | 276 | except TypeError: # Python 2.6 and older | ||
304 | 277 | httplib_response = conn.getresponse() | ||
305 | 278 | |||
306 | 279 | # AppEngine doesn't have a version attr. | ||
307 | 280 | http_version = getattr(conn, '_http_vsn_str', 'HTTP/?') | ||
308 | 281 | log.debug("\"%s %s %s\" %s %s" % (method, url, http_version, | ||
309 | 282 | httplib_response.status, | ||
310 | 283 | httplib_response.length)) | ||
311 | 284 | return httplib_response | ||
312 | 285 | |||
313 | 286 | def close(self): | ||
314 | 287 | """ | ||
315 | 288 | Close all pooled connections and disable the pool. | ||
316 | 289 | """ | ||
317 | 290 | # Disable access to the pool | ||
318 | 291 | old_pool, self.pool = self.pool, None | ||
319 | 292 | |||
320 | 293 | try: | ||
321 | 294 | while True: | ||
322 | 295 | conn = old_pool.get(block=False) | ||
323 | 296 | if conn: | ||
324 | 297 | conn.close() | ||
325 | 298 | |||
326 | 299 | except Empty: | ||
327 | 300 | pass # Done. | ||
328 | 301 | |||
329 | 302 | def is_same_host(self, url): | ||
330 | 303 | """ | ||
331 | 304 | Check if the given ``url`` is a member of the same host as this | ||
332 | 305 | connection pool. | ||
333 | 306 | """ | ||
334 | 307 | if url.startswith('/'): | ||
335 | 308 | return True | ||
336 | 309 | |||
337 | 310 | # TODO: Add optional support for socket.gethostbyname checking. | ||
338 | 311 | scheme, host, port = get_host(url) | ||
339 | 312 | |||
340 | 313 | if self.port and not port: | ||
341 | 314 | # Use explicit default port for comparison when none is given. | ||
342 | 315 | port = port_by_scheme.get(scheme) | ||
343 | 316 | |||
344 | 317 | return (scheme, host, port) == (self.scheme, self.host, self.port) | ||
345 | 318 | |||
346 | 319 | def urlopen(self, method, url, body=None, headers=None, retries=3, | ||
347 | 320 | redirect=True, assert_same_host=True, timeout=_Default, | ||
348 | 321 | pool_timeout=None, release_conn=None, **response_kw): | ||
349 | 322 | """ | ||
350 | 323 | Get a connection from the pool and perform an HTTP request. This is the | ||
351 | 324 | lowest level call for making a request, so you'll need to specify all | ||
352 | 325 | the raw details. | ||
353 | 326 | |||
354 | 327 | .. note:: | ||
355 | 328 | |||
356 | 329 | More commonly, it's appropriate to use a convenience method provided | ||
357 | 330 | by :class:`.RequestMethods`, such as :meth:`request`. | ||
358 | 331 | |||
359 | 332 | .. note:: | ||
360 | 333 | |||
361 | 334 | `release_conn` will only behave as expected if | ||
362 | 335 | `preload_content=False` because we want to make | ||
363 | 336 | `preload_content=False` the default behaviour someday soon without | ||
364 | 337 | breaking backwards compatibility. | ||
365 | 338 | |||
366 | 339 | :param method: | ||
367 | 340 | HTTP request method (such as GET, POST, PUT, etc.) | ||
368 | 341 | |||
369 | 342 | :param body: | ||
370 | 343 | Data to send in the request body (useful for creating | ||
371 | 344 | POST requests, see HTTPConnectionPool.post_url for | ||
372 | 345 | more convenience). | ||
373 | 346 | |||
374 | 347 | :param headers: | ||
375 | 348 | Dictionary of custom headers to send, such as User-Agent, | ||
376 | 349 | If-None-Match, etc. If None, pool headers are used. If provided, | ||
377 | 350 | these headers completely replace any pool-specific headers. | ||
378 | 351 | |||
379 | 352 | :param retries: | ||
380 | 353 | Number of retries to allow before raising a MaxRetryError exception. | ||
381 | 354 | |||
382 | 355 | :param redirect: | ||
383 | 356 | If True, automatically handle redirects (status codes 301, 302, | ||
384 | 357 | 303, 307). Each redirect counts as a retry. | ||
385 | 358 | |||
386 | 359 | :param assert_same_host: | ||
387 | 360 | If ``True``, will make sure that the host of the pool requests is | ||
388 | 361 | consistent else will raise HostChangedError. When False, you can | ||
389 | 362 | use the pool on an HTTP proxy and request foreign hosts. | ||
390 | 363 | |||
391 | 364 | :param timeout: | ||
392 | 365 | If specified, overrides the default timeout for this one request. | ||
393 | 366 | |||
394 | 367 | :param pool_timeout: | ||
395 | 368 | If set and the pool is set to block=True, then this method will | ||
396 | 369 | block for ``pool_timeout`` seconds and raise EmptyPoolError if no | ||
397 | 370 | connection is available within the time period. | ||
398 | 371 | |||
399 | 372 | :param release_conn: | ||
400 | 373 | If False, then the urlopen call will not release the connection | ||
401 | 374 | back into the pool once a response is received (but will release if | ||
402 | 375 | you read the entire contents of the response such as when | ||
403 | 376 | `preload_content=True`). This is useful if you're not preloading | ||
404 | 377 | the response's content immediately. You will need to call | ||
405 | 378 | ``r.release_conn()`` on the response ``r`` to return the connection | ||
406 | 379 | back into the pool. If None, it takes the value of | ||
407 | 380 | ``response_kw.get('preload_content', True)``. | ||
408 | 381 | |||
409 | 382 | :param \**response_kw: | ||
410 | 383 | Additional parameters are passed to | ||
411 | 384 | :meth:`urllib3.response.HTTPResponse.from_httplib` | ||
412 | 385 | """ | ||
413 | 386 | if headers is None: | ||
414 | 387 | headers = self.headers | ||
415 | 388 | |||
416 | 389 | if retries < 0: | ||
417 | 390 | raise MaxRetryError(self, url) | ||
418 | 391 | |||
419 | 392 | if timeout is _Default: | ||
420 | 393 | timeout = self.timeout | ||
421 | 394 | |||
422 | 395 | if release_conn is None: | ||
423 | 396 | release_conn = response_kw.get('preload_content', True) | ||
424 | 397 | |||
425 | 398 | # Check host | ||
426 | 399 | if assert_same_host and not self.is_same_host(url): | ||
427 | 400 | host = "%s://%s" % (self.scheme, self.host) | ||
428 | 401 | if self.port: | ||
429 | 402 | host = "%s:%d" % (host, self.port) | ||
430 | 403 | |||
431 | 404 | raise HostChangedError(self, url, retries - 1) | ||
432 | 405 | |||
433 | 406 | conn = None | ||
434 | 407 | |||
435 | 408 | try: | ||
436 | 409 | # Request a connection from the queue | ||
437 | 410 | conn = self._get_conn(timeout=pool_timeout) | ||
438 | 411 | |||
439 | 412 | # Make the request on the httplib connection object | ||
440 | 413 | httplib_response = self._make_request(conn, method, url, | ||
441 | 414 | timeout=timeout, | ||
442 | 415 | body=body, headers=headers) | ||
443 | 416 | |||
444 | 417 | # If we're going to release the connection in ``finally:``, then | ||
445 | 418 | # the request doesn't need to know about the connection. Otherwise | ||
446 | 419 | # it will also try to release it and we'll have a double-release | ||
447 | 420 | # mess. | ||
448 | 421 | response_conn = not release_conn and conn | ||
449 | 422 | |||
450 | 423 | # Import httplib's response into our own wrapper object | ||
451 | 424 | response = HTTPResponse.from_httplib(httplib_response, | ||
452 | 425 | pool=self, | ||
453 | 426 | connection=response_conn, | ||
454 | 427 | **response_kw) | ||
455 | 428 | |||
456 | 429 | # else: | ||
457 | 430 | # The connection will be put back into the pool when | ||
458 | 431 | # ``response.release_conn()`` is called (implicitly by | ||
459 | 432 | # ``response.read()``) | ||
460 | 433 | |||
461 | 434 | except Empty as e: | ||
462 | 435 | # Timed out by queue | ||
463 | 436 | raise TimeoutError(self, "Request timed out. (pool_timeout=%s)" % | ||
464 | 437 | pool_timeout) | ||
465 | 438 | |||
466 | 439 | except SocketTimeout as e: | ||
467 | 440 | # Timed out by socket | ||
468 | 441 | raise TimeoutError(self, "Request timed out. (timeout=%s)" % | ||
469 | 442 | timeout) | ||
470 | 443 | |||
471 | 444 | except BaseSSLError as e: | ||
472 | 445 | # SSL certificate error | ||
473 | 446 | raise SSLError(e) | ||
474 | 447 | |||
475 | 448 | except CertificateError as e: | ||
476 | 449 | # Name mismatch | ||
477 | 450 | raise SSLError(e) | ||
478 | 451 | |||
479 | 452 | except HTTPException as e: | ||
480 | 453 | # Connection broken, discard. It will be replaced next _get_conn(). | ||
481 | 454 | conn = None | ||
482 | 455 | # This is necessary so we can access e below | ||
483 | 456 | err = e | ||
484 | 457 | |||
485 | 458 | finally: | ||
486 | 459 | if release_conn: | ||
487 | 460 | # Put the connection back to be reused. If the connection is | ||
488 | 461 | # expired then it will be None, which will get replaced with a | ||
489 | 462 | # fresh connection during _get_conn. | ||
490 | 463 | self._put_conn(conn) | ||
491 | 464 | |||
492 | 465 | if not conn: | ||
493 | 466 | # Try again | ||
494 | 467 | log.warn("Retrying (%d attempts remain) after connection " | ||
495 | 468 | "broken by '%r': %s" % (retries, err, url)) | ||
496 | 469 | return self.urlopen(method, url, body, headers, retries - 1, | ||
497 | 470 | redirect, assert_same_host, | ||
498 | 471 | timeout=timeout, pool_timeout=pool_timeout, | ||
499 | 472 | release_conn=release_conn, **response_kw) | ||
500 | 473 | |||
501 | 474 | # Handle redirect? | ||
502 | 475 | redirect_location = redirect and response.get_redirect_location() | ||
503 | 476 | if redirect_location: | ||
504 | 477 | if response.status == 303: | ||
505 | 478 | method = 'GET' | ||
506 | 479 | log.info("Redirecting %s -> %s" % (url, redirect_location)) | ||
507 | 480 | return self.urlopen(method, redirect_location, body, headers, | ||
508 | 481 | retries - 1, redirect, assert_same_host, | ||
509 | 482 | timeout=timeout, pool_timeout=pool_timeout, | ||
510 | 483 | release_conn=release_conn, **response_kw) | ||
511 | 484 | |||
512 | 485 | return response | ||
513 | 486 | |||
514 | 487 | |||
515 | 488 | class HTTPSConnectionPool(HTTPConnectionPool): | ||
516 | 489 | """ | ||
517 | 490 | Same as :class:`.HTTPConnectionPool`, but HTTPS. | ||
518 | 491 | |||
519 | 492 | When Python is compiled with the :mod:`ssl` module, then | ||
520 | 493 | :class:`.VerifiedHTTPSConnection` is used, which *can* verify certificates, | ||
521 | 494 | instead of :class:httplib.HTTPSConnection`. | ||
522 | 495 | |||
523 | 496 | The ``key_file``, ``cert_file``, ``cert_reqs``, and ``ca_certs`` parameters | ||
524 | 497 | are only used if :mod:`ssl` is available and are fed into | ||
525 | 498 | :meth:`ssl.wrap_socket` to upgrade the connection socket into an SSL socket. | ||
526 | 499 | """ | ||
527 | 500 | |||
528 | 501 | scheme = 'https' | ||
529 | 502 | |||
530 | 503 | def __init__(self, host, port=None, | ||
531 | 504 | strict=False, timeout=None, maxsize=1, | ||
532 | 505 | block=False, headers=None, | ||
533 | 506 | key_file=None, cert_file=None, | ||
534 | 507 | cert_reqs='CERT_NONE', ca_certs=None): | ||
535 | 508 | |||
536 | 509 | super(HTTPSConnectionPool, self).__init__(host, port, | ||
537 | 510 | strict, timeout, maxsize, | ||
538 | 511 | block, headers) | ||
539 | 512 | self.key_file = key_file | ||
540 | 513 | self.cert_file = cert_file | ||
541 | 514 | self.cert_reqs = cert_reqs | ||
542 | 515 | self.ca_certs = ca_certs | ||
543 | 516 | |||
544 | 517 | def _new_conn(self): | ||
545 | 518 | """ | ||
546 | 519 | Return a fresh :class:`httplib.HTTPSConnection`. | ||
547 | 520 | """ | ||
548 | 521 | self.num_connections += 1 | ||
549 | 522 | log.info("Starting new HTTPS connection (%d): %s" | ||
550 | 523 | % (self.num_connections, self.host)) | ||
551 | 524 | |||
552 | 525 | if not ssl: # Platform-specific: Python compiled without +ssl | ||
553 | 526 | if not HTTPSConnection or HTTPSConnection is object: | ||
554 | 527 | raise SSLError("Can't connect to HTTPS URL because the SSL " | ||
555 | 528 | "module is not available.") | ||
556 | 529 | |||
557 | 530 | return HTTPSConnection(host=self.host, port=self.port) | ||
558 | 531 | |||
559 | 532 | connection = VerifiedHTTPSConnection(host=self.host, port=self.port) | ||
560 | 533 | connection.set_cert(key_file=self.key_file, cert_file=self.cert_file, | ||
561 | 534 | cert_reqs=self.cert_reqs, ca_certs=self.ca_certs) | ||
562 | 535 | return connection | ||
563 | 536 | |||
564 | 537 | |||
565 | 538 | def connection_from_url(url, **kw): | ||
566 | 539 | """ | ||
567 | 540 | Given a url, return an :class:`.ConnectionPool` instance of its host. | ||
568 | 541 | |||
569 | 542 | This is a shortcut for not having to parse out the scheme, host, and port | ||
570 | 543 | of the url before creating an :class:`.ConnectionPool` instance. | ||
571 | 544 | |||
572 | 545 | :param url: | ||
573 | 546 | Absolute URL string that must include the scheme. Port is optional. | ||
574 | 547 | |||
575 | 548 | :param \**kw: | ||
576 | 549 | Passes additional parameters to the constructor of the appropriate | ||
577 | 550 | :class:`.ConnectionPool`. Useful for specifying things like | ||
578 | 551 | timeout, maxsize, headers, etc. | ||
579 | 552 | |||
580 | 553 | Example: :: | ||
581 | 554 | |||
582 | 555 | >>> conn = connection_from_url('http://google.com/') | ||
583 | 556 | >>> r = conn.request('GET', '/') | ||
584 | 557 | """ | ||
585 | 558 | scheme, host, port = get_host(url) | ||
586 | 559 | if scheme == 'https': | ||
587 | 560 | return HTTPSConnectionPool(host, port=port, **kw) | ||
588 | 561 | else: | ||
589 | 562 | return HTTPConnectionPool(host, port=port, **kw) | ||
590 | 0 | 563 | ||
591 | === added file '.pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/filepost.py' | |||
592 | --- .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/filepost.py 1970-01-01 00:00:00 +0000 | |||
593 | +++ .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/filepost.py 2013-01-28 21:06:46 +0000 | |||
594 | @@ -0,0 +1,91 @@ | |||
595 | 1 | # urllib3/filepost.py | ||
596 | 2 | # Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt) | ||
597 | 3 | # | ||
598 | 4 | # This module is part of urllib3 and is released under | ||
599 | 5 | # the MIT License: http://www.opensource.org/licenses/mit-license.php | ||
600 | 6 | |||
601 | 7 | import codecs | ||
602 | 8 | import mimetypes | ||
603 | 9 | |||
604 | 10 | from uuid import uuid4 | ||
605 | 11 | from io import BytesIO | ||
606 | 12 | |||
607 | 13 | from .packages import six | ||
608 | 14 | from .packages.six import b | ||
609 | 15 | |||
610 | 16 | writer = codecs.lookup('utf-8')[3] | ||
611 | 17 | |||
612 | 18 | |||
613 | 19 | def choose_boundary(): | ||
614 | 20 | """ | ||
615 | 21 | Our embarassingly-simple replacement for mimetools.choose_boundary. | ||
616 | 22 | """ | ||
617 | 23 | return uuid4().hex | ||
618 | 24 | |||
619 | 25 | |||
620 | 26 | def get_content_type(filename): | ||
621 | 27 | return mimetypes.guess_type(filename)[0] or 'application/octet-stream' | ||
622 | 28 | |||
623 | 29 | |||
624 | 30 | def iter_fields(fields): | ||
625 | 31 | """ | ||
626 | 32 | Iterate over fields. | ||
627 | 33 | |||
628 | 34 | Supports list of (k, v) tuples and dicts. | ||
629 | 35 | """ | ||
630 | 36 | if isinstance(fields, dict): | ||
631 | 37 | return ((k, v) for k, v in six.iteritems(fields)) | ||
632 | 38 | |||
633 | 39 | return ((k, v) for k, v in fields) | ||
634 | 40 | |||
635 | 41 | |||
636 | 42 | def encode_multipart_formdata(fields, boundary=None): | ||
637 | 43 | """ | ||
638 | 44 | Encode a dictionary of ``fields`` using the multipart/form-data mime format. | ||
639 | 45 | |||
640 | 46 | :param fields: | ||
641 | 47 | Dictionary of fields or list of (key, value) field tuples. The key is | ||
642 | 48 | treated as the field name, and the value as the body of the form-data | ||
643 | 49 | bytes. If the value is a tuple of two elements, then the first element | ||
644 | 50 | is treated as the filename of the form-data section. | ||
645 | 51 | |||
646 | 52 | Field names and filenames must be unicode. | ||
647 | 53 | |||
648 | 54 | :param boundary: | ||
649 | 55 | If not specified, then a random boundary will be generated using | ||
650 | 56 | :func:`mimetools.choose_boundary`. | ||
651 | 57 | """ | ||
652 | 58 | body = BytesIO() | ||
653 | 59 | if boundary is None: | ||
654 | 60 | boundary = choose_boundary() | ||
655 | 61 | |||
656 | 62 | for fieldname, value in iter_fields(fields): | ||
657 | 63 | body.write(b('--%s\r\n' % (boundary))) | ||
658 | 64 | |||
659 | 65 | if isinstance(value, tuple): | ||
660 | 66 | filename, data = value | ||
661 | 67 | writer(body).write('Content-Disposition: form-data; name="%s"; ' | ||
662 | 68 | 'filename="%s"\r\n' % (fieldname, filename)) | ||
663 | 69 | body.write(b('Content-Type: %s\r\n\r\n' % | ||
664 | 70 | (get_content_type(filename)))) | ||
665 | 71 | else: | ||
666 | 72 | data = value | ||
667 | 73 | writer(body).write('Content-Disposition: form-data; name="%s"\r\n' | ||
668 | 74 | % (fieldname)) | ||
669 | 75 | body.write(b'Content-Type: text/plain\r\n\r\n') | ||
670 | 76 | |||
671 | 77 | if isinstance(data, int): | ||
672 | 78 | data = str(data) # Backwards compatibility | ||
673 | 79 | |||
674 | 80 | if isinstance(data, six.text_type): | ||
675 | 81 | writer(body).write(data) | ||
676 | 82 | else: | ||
677 | 83 | body.write(data) | ||
678 | 84 | |||
679 | 85 | body.write(b'\r\n') | ||
680 | 86 | |||
681 | 87 | body.write(b('--%s--\r\n' % (boundary))) | ||
682 | 88 | |||
683 | 89 | content_type = b('multipart/form-data; boundary=%s' % boundary) | ||
684 | 90 | |||
685 | 91 | return body.getvalue(), content_type | ||
686 | 0 | 92 | ||
687 | === added file '.pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/response.py' | |||
688 | --- .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/response.py 1970-01-01 00:00:00 +0000 | |||
689 | +++ .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/response.py 2013-01-28 21:06:46 +0000 | |||
690 | @@ -0,0 +1,202 @@ | |||
691 | 1 | # urllib3/response.py | ||
692 | 2 | # Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt) | ||
693 | 3 | # | ||
694 | 4 | # This module is part of urllib3 and is released under | ||
695 | 5 | # the MIT License: http://www.opensource.org/licenses/mit-license.php | ||
696 | 6 | |||
697 | 7 | import gzip | ||
698 | 8 | import logging | ||
699 | 9 | import zlib | ||
700 | 10 | |||
701 | 11 | from io import BytesIO | ||
702 | 12 | |||
703 | 13 | from .exceptions import DecodeError | ||
704 | 14 | from .packages.six import string_types as basestring | ||
705 | 15 | |||
706 | 16 | |||
707 | 17 | log = logging.getLogger(__name__) | ||
708 | 18 | |||
709 | 19 | |||
710 | 20 | def decode_gzip(data): | ||
711 | 21 | gzipper = gzip.GzipFile(fileobj=BytesIO(data)) | ||
712 | 22 | return gzipper.read() | ||
713 | 23 | |||
714 | 24 | |||
715 | 25 | def decode_deflate(data): | ||
716 | 26 | try: | ||
717 | 27 | return zlib.decompress(data) | ||
718 | 28 | except zlib.error: | ||
719 | 29 | return zlib.decompress(data, -zlib.MAX_WBITS) | ||
720 | 30 | |||
721 | 31 | |||
722 | 32 | class HTTPResponse(object): | ||
723 | 33 | """ | ||
724 | 34 | HTTP Response container. | ||
725 | 35 | |||
726 | 36 | Backwards-compatible to httplib's HTTPResponse but the response ``body`` is | ||
727 | 37 | loaded and decoded on-demand when the ``data`` property is accessed. | ||
728 | 38 | |||
729 | 39 | Extra parameters for behaviour not present in httplib.HTTPResponse: | ||
730 | 40 | |||
731 | 41 | :param preload_content: | ||
732 | 42 | If True, the response's body will be preloaded during construction. | ||
733 | 43 | |||
734 | 44 | :param decode_content: | ||
735 | 45 | If True, attempts to decode specific content-encoding's based on headers | ||
736 | 46 | (like 'gzip' and 'deflate') will be skipped and raw data will be used | ||
737 | 47 | instead. | ||
738 | 48 | |||
739 | 49 | :param original_response: | ||
740 | 50 | When this HTTPResponse wrapper is generated from an httplib.HTTPResponse | ||
741 | 51 | object, it's convenient to include the original for debug purposes. It's | ||
742 | 52 | otherwise unused. | ||
743 | 53 | """ | ||
744 | 54 | |||
745 | 55 | CONTENT_DECODERS = { | ||
746 | 56 | 'gzip': decode_gzip, | ||
747 | 57 | 'deflate': decode_deflate, | ||
748 | 58 | } | ||
749 | 59 | |||
750 | 60 | def __init__(self, body='', headers=None, status=0, version=0, reason=None, | ||
751 | 61 | strict=0, preload_content=True, decode_content=True, | ||
752 | 62 | original_response=None, pool=None, connection=None): | ||
753 | 63 | self.headers = headers or {} | ||
754 | 64 | self.status = status | ||
755 | 65 | self.version = version | ||
756 | 66 | self.reason = reason | ||
757 | 67 | self.strict = strict | ||
758 | 68 | |||
759 | 69 | self._decode_content = decode_content | ||
760 | 70 | self._body = body if body and isinstance(body, basestring) else None | ||
761 | 71 | self._fp = None | ||
762 | 72 | self._original_response = original_response | ||
763 | 73 | |||
764 | 74 | self._pool = pool | ||
765 | 75 | self._connection = connection | ||
766 | 76 | |||
767 | 77 | if hasattr(body, 'read'): | ||
768 | 78 | self._fp = body | ||
769 | 79 | |||
770 | 80 | if preload_content and not self._body: | ||
771 | 81 | self._body = self.read(decode_content=decode_content) | ||
772 | 82 | |||
773 | 83 | def get_redirect_location(self): | ||
774 | 84 | """ | ||
775 | 85 | Should we redirect and where to? | ||
776 | 86 | |||
777 | 87 | :returns: Truthy redirect location string if we got a redirect status | ||
778 | 88 | code and valid location. ``None`` if redirect status and no | ||
779 | 89 | location. ``False`` if not a redirect status code. | ||
780 | 90 | """ | ||
781 | 91 | if self.status in [301, 302, 303, 307]: | ||
782 | 92 | return self.headers.get('location') | ||
783 | 93 | |||
784 | 94 | return False | ||
785 | 95 | |||
786 | 96 | def release_conn(self): | ||
787 | 97 | if not self._pool or not self._connection: | ||
788 | 98 | return | ||
789 | 99 | |||
790 | 100 | self._pool._put_conn(self._connection) | ||
791 | 101 | self._connection = None | ||
792 | 102 | |||
793 | 103 | @property | ||
794 | 104 | def data(self): | ||
795 | 105 | # For backwords-compat with earlier urllib3 0.4 and earlier. | ||
796 | 106 | if self._body: | ||
797 | 107 | return self._body | ||
798 | 108 | |||
799 | 109 | if self._fp: | ||
800 | 110 | return self.read(cache_content=True) | ||
801 | 111 | |||
802 | 112 | def read(self, amt=None, decode_content=None, cache_content=False): | ||
803 | 113 | """ | ||
804 | 114 | Similar to :meth:`httplib.HTTPResponse.read`, but with two additional | ||
805 | 115 | parameters: ``decode_content`` and ``cache_content``. | ||
806 | 116 | |||
807 | 117 | :param amt: | ||
808 | 118 | How much of the content to read. If specified, decoding and caching | ||
809 | 119 | is skipped because we can't decode partial content nor does it make | ||
810 | 120 | sense to cache partial content as the full response. | ||
811 | 121 | |||
812 | 122 | :param decode_content: | ||
813 | 123 | If True, will attempt to decode the body based on the | ||
814 | 124 | 'content-encoding' header. (Overridden if ``amt`` is set.) | ||
815 | 125 | |||
816 | 126 | :param cache_content: | ||
817 | 127 | If True, will save the returned data such that the same result is | ||
818 | 128 | returned despite of the state of the underlying file object. This | ||
819 | 129 | is useful if you want the ``.data`` property to continue working | ||
820 | 130 | after having ``.read()`` the file object. (Overridden if ``amt`` is | ||
821 | 131 | set.) | ||
822 | 132 | """ | ||
823 | 133 | content_encoding = self.headers.get('content-encoding') | ||
824 | 134 | decoder = self.CONTENT_DECODERS.get(content_encoding) | ||
825 | 135 | if decode_content is None: | ||
826 | 136 | decode_content = self._decode_content | ||
827 | 137 | |||
828 | 138 | if self._fp is None: | ||
829 | 139 | return | ||
830 | 140 | |||
831 | 141 | try: | ||
832 | 142 | if amt is None: | ||
833 | 143 | # cStringIO doesn't like amt=None | ||
834 | 144 | data = self._fp.read() | ||
835 | 145 | else: | ||
836 | 146 | return self._fp.read(amt) | ||
837 | 147 | |||
838 | 148 | try: | ||
839 | 149 | if decode_content and decoder: | ||
840 | 150 | data = decoder(data) | ||
841 | 151 | except (IOError, zlib.error): | ||
842 | 152 | raise DecodeError("Received response with content-encoding: %s, but " | ||
843 | 153 | "failed to decode it." % content_encoding) | ||
844 | 154 | |||
845 | 155 | if cache_content: | ||
846 | 156 | self._body = data | ||
847 | 157 | |||
848 | 158 | return data | ||
849 | 159 | |||
850 | 160 | finally: | ||
851 | 161 | if self._original_response and self._original_response.isclosed(): | ||
852 | 162 | self.release_conn() | ||
853 | 163 | |||
854 | 164 | @classmethod | ||
855 | 165 | def from_httplib(ResponseCls, r, **response_kw): | ||
856 | 166 | """ | ||
857 | 167 | Given an :class:`httplib.HTTPResponse` instance ``r``, return a | ||
858 | 168 | corresponding :class:`urllib3.response.HTTPResponse` object. | ||
859 | 169 | |||
860 | 170 | Remaining parameters are passed to the HTTPResponse constructor, along | ||
861 | 171 | with ``original_response=r``. | ||
862 | 172 | """ | ||
863 | 173 | |||
864 | 174 | # Normalize headers between different versions of Python | ||
865 | 175 | headers = {} | ||
866 | 176 | for k, v in r.getheaders(): | ||
867 | 177 | # Python 3: Header keys are returned capitalised | ||
868 | 178 | k = k.lower() | ||
869 | 179 | |||
870 | 180 | has_value = headers.get(k) | ||
871 | 181 | if has_value: # Python 3: Repeating header keys are unmerged. | ||
872 | 182 | v = ', '.join([has_value, v]) | ||
873 | 183 | |||
874 | 184 | headers[k] = v | ||
875 | 185 | |||
876 | 186 | # HTTPResponse objects in Python 3 don't have a .strict attribute | ||
877 | 187 | strict = getattr(r, 'strict', 0) | ||
878 | 188 | return ResponseCls(body=r, | ||
879 | 189 | headers=headers, | ||
880 | 190 | status=r.status, | ||
881 | 191 | version=r.version, | ||
882 | 192 | reason=r.reason, | ||
883 | 193 | strict=strict, | ||
884 | 194 | original_response=r, | ||
885 | 195 | **response_kw) | ||
886 | 196 | |||
887 | 197 | # Backwards-compatibility methods for httplib.HTTPResponse | ||
888 | 198 | def getheaders(self): | ||
889 | 199 | return self.headers | ||
890 | 200 | |||
891 | 201 | def getheader(self, name, default=None): | ||
892 | 202 | return self.headers.get(name, default) | ||
893 | 0 | 203 | ||
894 | === added file '.pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/util.py' | |||
895 | --- .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/util.py 1970-01-01 00:00:00 +0000 | |||
896 | +++ .pc/02_do-not-use-embedded-python-six.patch/requests/packages/urllib3/util.py 2013-01-28 21:06:46 +0000 | |||
897 | @@ -0,0 +1,252 @@ | |||
898 | 1 | # urllib3/util.py | ||
899 | 2 | # Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt) | ||
900 | 3 | # | ||
901 | 4 | # This module is part of urllib3 and is released under | ||
902 | 5 | # the MIT License: http://www.opensource.org/licenses/mit-license.php | ||
903 | 6 | |||
904 | 7 | |||
905 | 8 | from base64 import b64encode | ||
906 | 9 | from collections import namedtuple | ||
907 | 10 | from socket import error as SocketError | ||
908 | 11 | |||
909 | 12 | try: | ||
910 | 13 | from select import poll, POLLIN | ||
911 | 14 | except ImportError: # `poll` doesn't exist on OSX and other platforms | ||
912 | 15 | poll = False | ||
913 | 16 | try: | ||
914 | 17 | from select import select | ||
915 | 18 | except ImportError: # `select` doesn't exist on AppEngine. | ||
916 | 19 | select = False | ||
917 | 20 | |||
918 | 21 | from .packages import six | ||
919 | 22 | from .exceptions import LocationParseError | ||
920 | 23 | |||
921 | 24 | |||
922 | 25 | class Url(namedtuple('Url', ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment'])): | ||
923 | 26 | """ | ||
924 | 27 | Datastructure for representing an HTTP URL. Used as a return value for | ||
925 | 28 | :func:`parse_url`. | ||
926 | 29 | """ | ||
927 | 30 | slots = () | ||
928 | 31 | |||
929 | 32 | def __new__(cls, scheme=None, auth=None, host=None, port=None, path=None, query=None, fragment=None): | ||
930 | 33 | return super(Url, cls).__new__(cls, scheme, auth, host, port, path, query, fragment) | ||
931 | 34 | |||
932 | 35 | @property | ||
933 | 36 | def hostname(self): | ||
934 | 37 | """For backwards-compatibility with urlparse. We're nice like that.""" | ||
935 | 38 | return self.host | ||
936 | 39 | |||
937 | 40 | @property | ||
938 | 41 | def request_uri(self): | ||
939 | 42 | """Absolute path including the query string.""" | ||
940 | 43 | uri = self.path or '/' | ||
941 | 44 | |||
942 | 45 | if self.query is not None: | ||
943 | 46 | uri += '?' + self.query | ||
944 | 47 | |||
945 | 48 | return uri | ||
946 | 49 | |||
947 | 50 | |||
948 | 51 | def split_first(s, delims): | ||
949 | 52 | """ | ||
950 | 53 | Given a string and an iterable of delimiters, split on the first found | ||
951 | 54 | delimiter. Return two split parts and the matched delimiter. | ||
952 | 55 | |||
953 | 56 | If not found, then the first part is the full input string. | ||
954 | 57 | |||
955 | 58 | Example: :: | ||
956 | 59 | |||
957 | 60 | >>> split_first('foo/bar?baz', '?/=') | ||
958 | 61 | ('foo', 'bar?baz', '/') | ||
959 | 62 | >>> split_first('foo/bar?baz', '123') | ||
960 | 63 | ('foo/bar?baz', '', None) | ||
961 | 64 | |||
962 | 65 | Scales linearly with number of delims. Not ideal for large number of delims. | ||
963 | 66 | """ | ||
964 | 67 | min_idx = None | ||
965 | 68 | min_delim = None | ||
966 | 69 | for d in delims: | ||
967 | 70 | idx = s.find(d) | ||
968 | 71 | if idx < 0: | ||
969 | 72 | continue | ||
970 | 73 | |||
971 | 74 | if min_idx is None or idx < min_idx: | ||
972 | 75 | min_idx = idx | ||
973 | 76 | min_delim = d | ||
974 | 77 | |||
975 | 78 | if min_idx is None or min_idx < 0: | ||
976 | 79 | return s, '', None | ||
977 | 80 | |||
978 | 81 | return s[:min_idx], s[min_idx+1:], min_delim | ||
979 | 82 | |||
980 | 83 | |||
981 | 84 | def parse_url(url): | ||
982 | 85 | """ | ||
983 | 86 | Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is | ||
984 | 87 | performed to parse incomplete urls. Fields not provided will be None. | ||
985 | 88 | |||
986 | 89 | Partly backwards-compatible with :mod:`urlparse`. | ||
987 | 90 | |||
988 | 91 | Example: :: | ||
989 | 92 | |||
990 | 93 | >>> parse_url('http://google.com/mail/') | ||
991 | 94 | Url(scheme='http', host='google.com', port=None, path='/', ...) | ||
992 | 95 | >>> prase_url('google.com:80') | ||
993 | 96 | Url(scheme=None, host='google.com', port=80, path=None, ...) | ||
994 | 97 | >>> prase_url('/foo?bar') | ||
995 | 98 | Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...) | ||
996 | 99 | """ | ||
997 | 100 | |||
998 | 101 | # While this code has overlap with stdlib's urlparse, it is much | ||
999 | 102 | # simplified for our needs and less annoying. | ||
1000 | 103 | # Additionally, this imeplementations does silly things to be optimal | ||
1001 | 104 | # on CPython. | ||
1002 | 105 | |||
1003 | 106 | scheme = None | ||
1004 | 107 | auth = None | ||
1005 | 108 | host = None | ||
1006 | 109 | port = None | ||
1007 | 110 | path = None | ||
1008 | 111 | fragment = None | ||
1009 | 112 | query = None | ||
1010 | 113 | |||
1011 | 114 | # Scheme | ||
1012 | 115 | if '://' in url: | ||
1013 | 116 | scheme, url = url.split('://', 1) | ||
1014 | 117 | |||
1015 | 118 | # Find the earliest Authority Terminator | ||
1016 | 119 | # (http://tools.ietf.org/html/rfc3986#section-3.2) | ||
1017 | 120 | url, path_, delim = split_first(url, ['/', '?', '#']) | ||
1018 | 121 | |||
1019 | 122 | if delim: | ||
1020 | 123 | # Reassemble the path | ||
1021 | 124 | path = delim + path_ | ||
1022 | 125 | |||
1023 | 126 | # Auth | ||
1024 | 127 | if '@' in url: | ||
1025 | 128 | auth, url = url.split('@', 1) | ||
1026 | 129 | |||
1027 | 130 | # IPv6 | ||
1028 | 131 | if url and url[0] == '[': | ||
1029 | 132 | host, url = url[1:].split(']', 1) | ||
1030 | 133 | |||
1031 | 134 | # Port | ||
1032 | 135 | if ':' in url: | ||
1033 | 136 | _host, port = url.split(':', 1) | ||
1034 | 137 | |||
1035 | 138 | if not host: | ||
1036 | 139 | host = _host | ||
1037 | 140 | |||
1038 | 141 | if not port.isdigit(): | ||
1039 | 142 | raise LocationParseError("Failed to parse: %s" % url) | ||
1040 | 143 | |||
1041 | 144 | port = int(port) | ||
1042 | 145 | |||
1043 | 146 | elif not host and url: | ||
1044 | 147 | host = url | ||
1045 | 148 | |||
1046 | 149 | if not path: | ||
1047 | 150 | return Url(scheme, auth, host, port, path, query, fragment) | ||
1048 | 151 | |||
1049 | 152 | # Fragment | ||
1050 | 153 | if '#' in path: | ||
1051 | 154 | path, fragment = path.split('#', 1) | ||
1052 | 155 | |||
1053 | 156 | # Query | ||
1054 | 157 | if '?' in path: | ||
1055 | 158 | path, query = path.split('?', 1) | ||
1056 | 159 | |||
1057 | 160 | return Url(scheme, auth, host, port, path, query, fragment) | ||
1058 | 161 | |||
1059 | 162 | |||
1060 | 163 | def get_host(url): | ||
1061 | 164 | """ | ||
1062 | 165 | Deprecated. Use :func:`.parse_url` instead. | ||
1063 | 166 | """ | ||
1064 | 167 | p = parse_url(url) | ||
1065 | 168 | return p.scheme or 'http', p.hostname, p.port | ||
1066 | 169 | |||
1067 | 170 | |||
1068 | 171 | def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, | ||
1069 | 172 | basic_auth=None): | ||
1070 | 173 | """ | ||
1071 | 174 | Shortcuts for generating request headers. | ||
1072 | 175 | |||
1073 | 176 | :param keep_alive: | ||
1074 | 177 | If ``True``, adds 'connection: keep-alive' header. | ||
1075 | 178 | |||
1076 | 179 | :param accept_encoding: | ||
1077 | 180 | Can be a boolean, list, or string. | ||
1078 | 181 | ``True`` translates to 'gzip,deflate'. | ||
1079 | 182 | List will get joined by comma. | ||
1080 | 183 | String will be used as provided. | ||
1081 | 184 | |||
1082 | 185 | :param user_agent: | ||
1083 | 186 | String representing the user-agent you want, such as | ||
1084 | 187 | "python-urllib3/0.6" | ||
1085 | 188 | |||
1086 | 189 | :param basic_auth: | ||
1087 | 190 | Colon-separated username:password string for 'authorization: basic ...' | ||
1088 | 191 | auth header. | ||
1089 | 192 | |||
1090 | 193 | Example: :: | ||
1091 | 194 | |||
1092 | 195 | >>> make_headers(keep_alive=True, user_agent="Batman/1.0") | ||
1093 | 196 | {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} | ||
1094 | 197 | >>> make_headers(accept_encoding=True) | ||
1095 | 198 | {'accept-encoding': 'gzip,deflate'} | ||
1096 | 199 | """ | ||
1097 | 200 | headers = {} | ||
1098 | 201 | if accept_encoding: | ||
1099 | 202 | if isinstance(accept_encoding, str): | ||
1100 | 203 | pass | ||
1101 | 204 | elif isinstance(accept_encoding, list): | ||
1102 | 205 | accept_encoding = ','.join(accept_encoding) | ||
1103 | 206 | else: | ||
1104 | 207 | accept_encoding = 'gzip,deflate' | ||
1105 | 208 | headers['accept-encoding'] = accept_encoding | ||
1106 | 209 | |||
1107 | 210 | if user_agent: | ||
1108 | 211 | headers['user-agent'] = user_agent | ||
1109 | 212 | |||
1110 | 213 | if keep_alive: | ||
1111 | 214 | headers['connection'] = 'keep-alive' | ||
1112 | 215 | |||
1113 | 216 | if basic_auth: | ||
1114 | 217 | headers['authorization'] = 'Basic ' + \ | ||
1115 | 218 | b64encode(six.b(basic_auth)).decode('utf-8') | ||
1116 | 219 | |||
1117 | 220 | return headers | ||
1118 | 221 | |||
1119 | 222 | |||
1120 | 223 | def is_connection_dropped(conn): | ||
1121 | 224 | """ | ||
1122 | 225 | Returns True if the connection is dropped and should be closed. | ||
1123 | 226 | |||
1124 | 227 | :param conn: | ||
1125 | 228 | :class:`httplib.HTTPConnection` object. | ||
1126 | 229 | |||
1127 | 230 | Note: For platforms like AppEngine, this will always return ``False`` to | ||
1128 | 231 | let the platform handle connection recycling transparently for us. | ||
1129 | 232 | """ | ||
1130 | 233 | sock = getattr(conn, 'sock', False) | ||
1131 | 234 | if not sock: # Platform-specific: AppEngine | ||
1132 | 235 | return False | ||
1133 | 236 | |||
1134 | 237 | if not poll: # Platform-specific | ||
1135 | 238 | if not select: # Platform-specific: AppEngine | ||
1136 | 239 | return False | ||
1137 | 240 | |||
1138 | 241 | try: | ||
1139 | 242 | return select([sock], [], [], 0.0)[0] | ||
1140 | 243 | except SocketError: | ||
1141 | 244 | return True | ||
1142 | 245 | |||
1143 | 246 | # This version is better on platforms that support it. | ||
1144 | 247 | p = poll() | ||
1145 | 248 | p.register(sock, POLLIN) | ||
1146 | 249 | for (fno, ev) in p.poll(0.0): | ||
1147 | 250 | if fno == sock.fileno(): | ||
1148 | 251 | # Either data is buffered (bad), or the connection is dropped. | ||
1149 | 252 | return True | ||
1150 | 0 | 253 | ||
1151 | === added directory '.pc/03-use-distro-packages.patch' | |||
1152 | === added directory '.pc/03-use-distro-packages.patch/requests' | |||
1153 | === added file '.pc/03-use-distro-packages.patch/requests/adapters.py' | |||
1154 | --- .pc/03-use-distro-packages.patch/requests/adapters.py 1970-01-01 00:00:00 +0000 | |||
1155 | +++ .pc/03-use-distro-packages.patch/requests/adapters.py 2013-01-28 21:06:46 +0000 | |||
1156 | @@ -0,0 +1,58 @@ | |||
1157 | 1 | # -*- coding: utf-8 -*- | ||
1158 | 2 | |||
1159 | 3 | """ | ||
1160 | 4 | requests.adapters | ||
1161 | 5 | ~~~~~~~~~~~~~~~~~ | ||
1162 | 6 | |||
1163 | 7 | This module contains the transport adapters that Requests uses to define | ||
1164 | 8 | and maintain connections. | ||
1165 | 9 | """ | ||
1166 | 10 | |||
1167 | 11 | from .packages.urllib3.poolmanager import PoolManager | ||
1168 | 12 | |||
1169 | 13 | class BaseAdapter(object): | ||
1170 | 14 | """The Base Transport Adapter""" | ||
1171 | 15 | |||
1172 | 16 | def __init__(self, config=None): | ||
1173 | 17 | super(BaseAdapter, self).__init__() | ||
1174 | 18 | self.config = config or {} | ||
1175 | 19 | self.session = None | ||
1176 | 20 | |||
1177 | 21 | @property | ||
1178 | 22 | def configure(self, config): | ||
1179 | 23 | self.config.update(config) | ||
1180 | 24 | |||
1181 | 25 | def send(self): | ||
1182 | 26 | raise NotImplementedError | ||
1183 | 27 | |||
1184 | 28 | def close(self): | ||
1185 | 29 | raise NotImplementedError | ||
1186 | 30 | |||
1187 | 31 | |||
1188 | 32 | class HTTPAdapter(BaseAdapter): | ||
1189 | 33 | """Built-In HTTP Adapter for Urllib3.""" | ||
1190 | 34 | def __init__(self): | ||
1191 | 35 | super(HTTPAdapter, self).__init__() | ||
1192 | 36 | |||
1193 | 37 | self.init_poolmanager() | ||
1194 | 38 | |||
1195 | 39 | def init_poolmanager(self): | ||
1196 | 40 | self.poolmanager = PoolManager( | ||
1197 | 41 | num_pools=self.config.get('pool_connections'), | ||
1198 | 42 | maxsize=self.config.get('pool_maxsize') | ||
1199 | 43 | ) | ||
1200 | 44 | |||
1201 | 45 | def close(self): | ||
1202 | 46 | """Dispose of any internal state. | ||
1203 | 47 | |||
1204 | 48 | Currently, this just closes the PoolManager, which closes pooled | ||
1205 | 49 | connections. | ||
1206 | 50 | """ | ||
1207 | 51 | self.poolmanager.clear() | ||
1208 | 52 | |||
1209 | 53 | def send(self, request): | ||
1210 | 54 | """Sends request object. Returns Response object.""" | ||
1211 | 55 | pass | ||
1212 | 56 | |||
1213 | 57 | |||
1214 | 58 | |||
1215 | 0 | 59 | ||
1216 | === added file '.pc/03-use-distro-packages.patch/requests/compat.py' | |||
1217 | --- .pc/03-use-distro-packages.patch/requests/compat.py 1970-01-01 00:00:00 +0000 | |||
1218 | +++ .pc/03-use-distro-packages.patch/requests/compat.py 2013-01-28 21:06:46 +0000 | |||
1219 | @@ -0,0 +1,119 @@ | |||
1220 | 1 | # -*- coding: utf-8 -*- | ||
1221 | 2 | |||
1222 | 3 | """ | ||
1223 | 4 | pythoncompat | ||
1224 | 5 | """ | ||
1225 | 6 | |||
1226 | 7 | |||
1227 | 8 | import sys | ||
1228 | 9 | |||
1229 | 10 | # ------- | ||
1230 | 11 | # Pythons | ||
1231 | 12 | # ------- | ||
1232 | 13 | |||
1233 | 14 | # Syntax sugar. | ||
1234 | 15 | _ver = sys.version_info | ||
1235 | 16 | |||
1236 | 17 | #: Python 2.x? | ||
1237 | 18 | is_py2 = (_ver[0] == 2) | ||
1238 | 19 | |||
1239 | 20 | #: Python 3.x? | ||
1240 | 21 | is_py3 = (_ver[0] == 3) | ||
1241 | 22 | |||
1242 | 23 | #: Python 3.0.x | ||
1243 | 24 | is_py30 = (is_py3 and _ver[1] == 0) | ||
1244 | 25 | |||
1245 | 26 | #: Python 3.1.x | ||
1246 | 27 | is_py31 = (is_py3 and _ver[1] == 1) | ||
1247 | 28 | |||
1248 | 29 | #: Python 3.2.x | ||
1249 | 30 | is_py32 = (is_py3 and _ver[1] == 2) | ||
1250 | 31 | |||
1251 | 32 | #: Python 3.3.x | ||
1252 | 33 | is_py33 = (is_py3 and _ver[1] == 3) | ||
1253 | 34 | |||
1254 | 35 | #: Python 3.4.x | ||
1255 | 36 | is_py34 = (is_py3 and _ver[1] == 4) | ||
1256 | 37 | |||
1257 | 38 | #: Python 2.7.x | ||
1258 | 39 | is_py27 = (is_py2 and _ver[1] == 7) | ||
1259 | 40 | |||
1260 | 41 | #: Python 2.6.x | ||
1261 | 42 | is_py26 = (is_py2 and _ver[1] == 6) | ||
1262 | 43 | |||
1263 | 44 | #: Python 2.5.x | ||
1264 | 45 | is_py25 = (is_py2 and _ver[1] == 5) | ||
1265 | 46 | |||
1266 | 47 | #: Python 2.4.x | ||
1267 | 48 | is_py24 = (is_py2 and _ver[1] == 4) # I'm assuming this is not by choice. | ||
1268 | 49 | |||
1269 | 50 | |||
1270 | 51 | # --------- | ||
1271 | 52 | # Platforms | ||
1272 | 53 | # --------- | ||
1273 | 54 | |||
1274 | 55 | |||
1275 | 56 | # Syntax sugar. | ||
1276 | 57 | _ver = sys.version.lower() | ||
1277 | 58 | |||
1278 | 59 | is_pypy = ('pypy' in _ver) | ||
1279 | 60 | is_jython = ('jython' in _ver) | ||
1280 | 61 | is_ironpython = ('iron' in _ver) | ||
1281 | 62 | |||
1282 | 63 | # Assume CPython, if nothing else. | ||
1283 | 64 | is_cpython = not any((is_pypy, is_jython, is_ironpython)) | ||
1284 | 65 | |||
1285 | 66 | # Windows-based system. | ||
1286 | 67 | is_windows = 'win32' in str(sys.platform).lower() | ||
1287 | 68 | |||
1288 | 69 | # Standard Linux 2+ system. | ||
1289 | 70 | is_linux = ('linux' in str(sys.platform).lower()) | ||
1290 | 71 | is_osx = ('darwin' in str(sys.platform).lower()) | ||
1291 | 72 | is_hpux = ('hpux' in str(sys.platform).lower()) # Complete guess. | ||
1292 | 73 | is_solaris = ('solar==' in str(sys.platform).lower()) # Complete guess. | ||
1293 | 74 | |||
1294 | 75 | try: | ||
1295 | 76 | import simplejson as json | ||
1296 | 77 | except ImportError: | ||
1297 | 78 | import json | ||
1298 | 79 | |||
1299 | 80 | # --------- | ||
1300 | 81 | # Specifics | ||
1301 | 82 | # --------- | ||
1302 | 83 | |||
1303 | 84 | |||
1304 | 85 | if is_py2: | ||
1305 | 86 | from urllib import quote, unquote, quote_plus, unquote_plus, urlencode | ||
1306 | 87 | from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag | ||
1307 | 88 | from urllib2 import parse_http_list | ||
1308 | 89 | import cookielib | ||
1309 | 90 | from Cookie import Morsel | ||
1310 | 91 | from StringIO import StringIO | ||
1311 | 92 | try: | ||
1312 | 93 | import cchardet as chardet | ||
1313 | 94 | except ImportError: | ||
1314 | 95 | from .packages import chardet | ||
1315 | 96 | from .packages.urllib3.packages.ordered_dict import OrderedDict | ||
1316 | 97 | |||
1317 | 98 | builtin_str = str | ||
1318 | 99 | bytes = str | ||
1319 | 100 | str = unicode | ||
1320 | 101 | basestring = basestring | ||
1321 | 102 | numeric_types = (int, long, float) | ||
1322 | 103 | |||
1323 | 104 | |||
1324 | 105 | |||
1325 | 106 | elif is_py3: | ||
1326 | 107 | from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag | ||
1327 | 108 | from urllib.request import parse_http_list | ||
1328 | 109 | from http import cookiejar as cookielib | ||
1329 | 110 | from http.cookies import Morsel | ||
1330 | 111 | from io import StringIO | ||
1331 | 112 | from .packages import chardet2 as chardet | ||
1332 | 113 | from collections import OrderedDict | ||
1333 | 114 | |||
1334 | 115 | builtin_str = str | ||
1335 | 116 | str = str | ||
1336 | 117 | bytes = bytes | ||
1337 | 118 | basestring = (str, bytes) | ||
1338 | 119 | numeric_types = (int, float) | ||
1339 | 0 | 120 | ||
1340 | === added file '.pc/03-use-distro-packages.patch/requests/models.py' | |||
1341 | --- .pc/03-use-distro-packages.patch/requests/models.py 1970-01-01 00:00:00 +0000 | |||
1342 | +++ .pc/03-use-distro-packages.patch/requests/models.py 2013-01-28 21:06:46 +0000 | |||
1343 | @@ -0,0 +1,907 @@ | |||
1344 | 1 | # -*- coding: utf-8 -*- | ||
1345 | 2 | |||
1346 | 3 | """ | ||
1347 | 4 | requests.models | ||
1348 | 5 | ~~~~~~~~~~~~~~~ | ||
1349 | 6 | |||
1350 | 7 | This module contains the primary objects that power Requests. | ||
1351 | 8 | """ | ||
1352 | 9 | |||
1353 | 10 | import os | ||
1354 | 11 | import socket | ||
1355 | 12 | from datetime import datetime | ||
1356 | 13 | from io import BytesIO | ||
1357 | 14 | |||
1358 | 15 | from .hooks import dispatch_hook, HOOKS | ||
1359 | 16 | from .structures import CaseInsensitiveDict | ||
1360 | 17 | from .status_codes import codes | ||
1361 | 18 | |||
1362 | 19 | from .auth import HTTPBasicAuth, HTTPProxyAuth | ||
1363 | 20 | from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header | ||
1364 | 21 | from .packages.urllib3.exceptions import MaxRetryError, LocationParseError | ||
1365 | 22 | from .packages.urllib3.exceptions import TimeoutError | ||
1366 | 23 | from .packages.urllib3.exceptions import SSLError as _SSLError | ||
1367 | 24 | from .packages.urllib3.exceptions import HTTPError as _HTTPError | ||
1368 | 25 | from .packages.urllib3 import connectionpool, poolmanager | ||
1369 | 26 | from .packages.urllib3.filepost import encode_multipart_formdata | ||
1370 | 27 | from .defaults import SCHEMAS | ||
1371 | 28 | from .exceptions import ( | ||
1372 | 29 | ConnectionError, HTTPError, RequestException, Timeout, TooManyRedirects, | ||
1373 | 30 | URLRequired, SSLError, MissingSchema, InvalidSchema, InvalidURL) | ||
1374 | 31 | from .utils import ( | ||
1375 | 32 | get_encoding_from_headers, stream_untransfer, guess_filename, requote_uri, | ||
1376 | 33 | stream_decode_response_unicode, get_netrc_auth, get_environ_proxies, | ||
1377 | 34 | to_key_val_list, DEFAULT_CA_BUNDLE_PATH, parse_header_links, iter_slices, | ||
1378 | 35 | guess_json_utf) | ||
1379 | 36 | from .compat import ( | ||
1380 | 37 | cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes, | ||
1381 | 38 | StringIO, is_py2, chardet, json, builtin_str, urldefrag) | ||
1382 | 39 | |||
1383 | 40 | REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved) | ||
1384 | 41 | CONTENT_CHUNK_SIZE = 10 * 1024 | ||
1385 | 42 | |||
1386 | 43 | |||
1387 | 44 | class Request(object): | ||
1388 | 45 | """The :class:`Request <Request>` object. It carries out all functionality | ||
1389 | 46 | of Requests. Recommended interface is with the Requests functions. | ||
1390 | 47 | """ | ||
1391 | 48 | |||
1392 | 49 | def __init__(self, | ||
1393 | 50 | url=None, | ||
1394 | 51 | headers=dict(), | ||
1395 | 52 | files=None, | ||
1396 | 53 | method=None, | ||
1397 | 54 | data=dict(), | ||
1398 | 55 | params=dict(), | ||
1399 | 56 | auth=None, | ||
1400 | 57 | cookies=None, | ||
1401 | 58 | timeout=None, | ||
1402 | 59 | redirect=False, | ||
1403 | 60 | allow_redirects=False, | ||
1404 | 61 | proxies=None, | ||
1405 | 62 | hooks=None, | ||
1406 | 63 | config=None, | ||
1407 | 64 | prefetch=True, | ||
1408 | 65 | _poolmanager=None, | ||
1409 | 66 | verify=None, | ||
1410 | 67 | session=None, | ||
1411 | 68 | cert=None): | ||
1412 | 69 | |||
1413 | 70 | #: Dictionary of configurations for this request. | ||
1414 | 71 | self.config = dict(config or []) | ||
1415 | 72 | |||
1416 | 73 | #: Float describes the timeout of the request. | ||
1417 | 74 | # (Use socket.setdefaulttimeout() as fallback) | ||
1418 | 75 | self.timeout = timeout | ||
1419 | 76 | |||
1420 | 77 | #: Request URL. | ||
1421 | 78 | #: Accept objects that have string representations. | ||
1422 | 79 | try: | ||
1423 | 80 | self.url = unicode(url) | ||
1424 | 81 | except NameError: | ||
1425 | 82 | # We're on Python 3. | ||
1426 | 83 | self.url = str(url) | ||
1427 | 84 | except UnicodeDecodeError: | ||
1428 | 85 | self.url = url | ||
1429 | 86 | |||
1430 | 87 | #: Dictionary of HTTP Headers to attach to the :class:`Request <Request>`. | ||
1431 | 88 | self.headers = dict(headers or []) | ||
1432 | 89 | |||
1433 | 90 | #: Dictionary of files to multipart upload (``{filename: content}``). | ||
1434 | 91 | self.files = None | ||
1435 | 92 | |||
1436 | 93 | #: HTTP Method to use. | ||
1437 | 94 | self.method = method | ||
1438 | 95 | |||
1439 | 96 | #: Dictionary, bytes or file stream of request body data to attach to the | ||
1440 | 97 | #: :class:`Request <Request>`. | ||
1441 | 98 | self.data = None | ||
1442 | 99 | |||
1443 | 100 | #: Dictionary or byte of querystring data to attach to the | ||
1444 | 101 | #: :class:`Request <Request>`. The dictionary values can be lists for representing | ||
1445 | 102 | #: multivalued query parameters. | ||
1446 | 103 | self.params = None | ||
1447 | 104 | |||
1448 | 105 | #: True if :class:`Request <Request>` is part of a redirect chain (disables history | ||
1449 | 106 | #: and HTTPError storage). | ||
1450 | 107 | self.redirect = redirect | ||
1451 | 108 | |||
1452 | 109 | #: Set to True if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``) | ||
1453 | 110 | self.allow_redirects = allow_redirects | ||
1454 | 111 | |||
1455 | 112 | # Dictionary mapping protocol to the URL of the proxy (e.g. {'http': 'foo.bar:3128'}) | ||
1456 | 113 | self.proxies = dict(proxies or []) | ||
1457 | 114 | |||
1458 | 115 | for proxy_type, uri_ref in list(self.proxies.items()): | ||
1459 | 116 | if not uri_ref: | ||
1460 | 117 | del self.proxies[proxy_type] | ||
1461 | 118 | |||
1462 | 119 | # If no proxies are given, allow configuration by environment variables | ||
1463 | 120 | # HTTP_PROXY and HTTPS_PROXY. | ||
1464 | 121 | if not self.proxies and self.config.get('trust_env'): | ||
1465 | 122 | self.proxies = get_environ_proxies() | ||
1466 | 123 | |||
1467 | 124 | self.data = data | ||
1468 | 125 | self.params = params | ||
1469 | 126 | self.files = files | ||
1470 | 127 | |||
1471 | 128 | #: :class:`Response <Response>` instance, containing | ||
1472 | 129 | #: content and metadata of HTTP Response, once :attr:`sent <send>`. | ||
1473 | 130 | self.response = Response() | ||
1474 | 131 | |||
1475 | 132 | #: Authentication tuple or object to attach to :class:`Request <Request>`. | ||
1476 | 133 | self.auth = auth | ||
1477 | 134 | |||
1478 | 135 | #: CookieJar to attach to :class:`Request <Request>`. | ||
1479 | 136 | if isinstance(cookies, cookielib.CookieJar): | ||
1480 | 137 | self.cookies = cookies | ||
1481 | 138 | else: | ||
1482 | 139 | self.cookies = cookiejar_from_dict(cookies) | ||
1483 | 140 | |||
1484 | 141 | #: True if Request has been sent. | ||
1485 | 142 | self.sent = False | ||
1486 | 143 | |||
1487 | 144 | #: Event-handling hooks. | ||
1488 | 145 | self.hooks = {} | ||
1489 | 146 | |||
1490 | 147 | for event in HOOKS: | ||
1491 | 148 | self.hooks[event] = [] | ||
1492 | 149 | |||
1493 | 150 | hooks = hooks or {} | ||
1494 | 151 | |||
1495 | 152 | for (k, v) in list(hooks.items()): | ||
1496 | 153 | self.register_hook(event=k, hook=v) | ||
1497 | 154 | |||
1498 | 155 | #: Session. | ||
1499 | 156 | self.session = session | ||
1500 | 157 | |||
1501 | 158 | #: SSL Verification. | ||
1502 | 159 | self.verify = verify | ||
1503 | 160 | |||
1504 | 161 | #: SSL Certificate | ||
1505 | 162 | self.cert = cert | ||
1506 | 163 | |||
1507 | 164 | #: Prefetch response content | ||
1508 | 165 | self.prefetch = prefetch | ||
1509 | 166 | |||
1510 | 167 | if headers: | ||
1511 | 168 | headers = CaseInsensitiveDict(self.headers) | ||
1512 | 169 | else: | ||
1513 | 170 | headers = CaseInsensitiveDict() | ||
1514 | 171 | |||
1515 | 172 | # Add configured base headers. | ||
1516 | 173 | for (k, v) in list(self.config.get('base_headers', {}).items()): | ||
1517 | 174 | if k not in headers: | ||
1518 | 175 | headers[k] = v | ||
1519 | 176 | |||
1520 | 177 | self.headers = headers | ||
1521 | 178 | self._poolmanager = _poolmanager | ||
1522 | 179 | |||
1523 | 180 | def __repr__(self): | ||
1524 | 181 | return '<Request [%s]>' % (self.method) | ||
1525 | 182 | |||
1526 | 183 | def _build_response(self, resp): | ||
1527 | 184 | """Build internal :class:`Response <Response>` object | ||
1528 | 185 | from given response. | ||
1529 | 186 | """ | ||
1530 | 187 | |||
1531 | 188 | def build(resp): | ||
1532 | 189 | |||
1533 | 190 | response = Response() | ||
1534 | 191 | |||
1535 | 192 | # Pass settings over. | ||
1536 | 193 | response.config = self.config | ||
1537 | 194 | |||
1538 | 195 | if resp: | ||
1539 | 196 | |||
1540 | 197 | # Fallback to None if there's no status_code, for whatever reason. | ||
1541 | 198 | response.status_code = getattr(resp, 'status', None) | ||
1542 | 199 | |||
1543 | 200 | # Make headers case-insensitive. | ||
1544 | 201 | response.headers = CaseInsensitiveDict(getattr(resp, 'headers', {})) | ||
1545 | 202 | |||
1546 | 203 | # Set encoding. | ||
1547 | 204 | response.encoding = get_encoding_from_headers(response.headers) | ||
1548 | 205 | |||
1549 | 206 | # Add new cookies from the server. Don't if configured not to | ||
1550 | 207 | if self.config.get('store_cookies'): | ||
1551 | 208 | extract_cookies_to_jar(self.cookies, self, resp) | ||
1552 | 209 | |||
1553 | 210 | # Save cookies in Response. | ||
1554 | 211 | response.cookies = self.cookies | ||
1555 | 212 | |||
1556 | 213 | # Save cookies in Session. | ||
1557 | 214 | for cookie in self.cookies: | ||
1558 | 215 | self.session.cookies.set_cookie(cookie) | ||
1559 | 216 | |||
1560 | 217 | # No exceptions were harmed in the making of this request. | ||
1561 | 218 | response.error = getattr(resp, 'error', None) | ||
1562 | 219 | |||
1563 | 220 | # Save original response for later. | ||
1564 | 221 | response.raw = resp | ||
1565 | 222 | if isinstance(self.full_url, bytes): | ||
1566 | 223 | response.url = self.full_url.decode('utf-8') | ||
1567 | 224 | else: | ||
1568 | 225 | response.url = self.full_url | ||
1569 | 226 | |||
1570 | 227 | return response | ||
1571 | 228 | |||
1572 | 229 | history = [] | ||
1573 | 230 | |||
1574 | 231 | r = build(resp) | ||
1575 | 232 | |||
1576 | 233 | if r.status_code in REDIRECT_STATI and not self.redirect: | ||
1577 | 234 | |||
1578 | 235 | while (('location' in r.headers) and | ||
1579 | 236 | ((r.status_code is codes.see_other) or (self.allow_redirects))): | ||
1580 | 237 | |||
1581 | 238 | r.content # Consume socket so it can be released | ||
1582 | 239 | |||
1583 | 240 | if not len(history) < self.config.get('max_redirects'): | ||
1584 | 241 | raise TooManyRedirects() | ||
1585 | 242 | |||
1586 | 243 | # Release the connection back into the pool. | ||
1587 | 244 | r.raw.release_conn() | ||
1588 | 245 | |||
1589 | 246 | history.append(r) | ||
1590 | 247 | |||
1591 | 248 | url = r.headers['location'] | ||
1592 | 249 | data = self.data | ||
1593 | 250 | files = self.files | ||
1594 | 251 | |||
1595 | 252 | # Handle redirection without scheme (see: RFC 1808 Section 4) | ||
1596 | 253 | if url.startswith('//'): | ||
1597 | 254 | parsed_rurl = urlparse(r.url) | ||
1598 | 255 | url = '%s:%s' % (parsed_rurl.scheme, url) | ||
1599 | 256 | |||
1600 | 257 | # Facilitate non-RFC2616-compliant 'location' headers | ||
1601 | 258 | # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') | ||
1602 | 259 | if not urlparse(url).netloc: | ||
1603 | 260 | url = urljoin(r.url, | ||
1604 | 261 | # Compliant with RFC3986, we percent | ||
1605 | 262 | # encode the url. | ||
1606 | 263 | requote_uri(url)) | ||
1607 | 264 | |||
1608 | 265 | # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4 | ||
1609 | 266 | if r.status_code is codes.see_other: | ||
1610 | 267 | method = 'GET' | ||
1611 | 268 | data = None | ||
1612 | 269 | files = None | ||
1613 | 270 | else: | ||
1614 | 271 | method = self.method | ||
1615 | 272 | |||
1616 | 273 | # Do what the browsers do if strict_mode is off... | ||
1617 | 274 | if (not self.config.get('strict_mode')): | ||
1618 | 275 | |||
1619 | 276 | if r.status_code in (codes.moved, codes.found) and self.method == 'POST': | ||
1620 | 277 | method = 'GET' | ||
1621 | 278 | data = None | ||
1622 | 279 | files = None | ||
1623 | 280 | |||
1624 | 281 | if (r.status_code == 303) and self.method != 'HEAD': | ||
1625 | 282 | method = 'GET' | ||
1626 | 283 | data = None | ||
1627 | 284 | files = None | ||
1628 | 285 | |||
1629 | 286 | # Remove the cookie headers that were sent. | ||
1630 | 287 | headers = self.headers | ||
1631 | 288 | try: | ||
1632 | 289 | del headers['Cookie'] | ||
1633 | 290 | except KeyError: | ||
1634 | 291 | pass | ||
1635 | 292 | |||
1636 | 293 | request = Request( | ||
1637 | 294 | url=url, | ||
1638 | 295 | headers=headers, | ||
1639 | 296 | files=files, | ||
1640 | 297 | method=method, | ||
1641 | 298 | params=self.session.params, | ||
1642 | 299 | auth=self.auth, | ||
1643 | 300 | cookies=self.cookies, | ||
1644 | 301 | redirect=True, | ||
1645 | 302 | data=data, | ||
1646 | 303 | config=self.config, | ||
1647 | 304 | timeout=self.timeout, | ||
1648 | 305 | _poolmanager=self._poolmanager, | ||
1649 | 306 | proxies=self.proxies, | ||
1650 | 307 | verify=self.verify, | ||
1651 | 308 | session=self.session, | ||
1652 | 309 | cert=self.cert, | ||
1653 | 310 | prefetch=self.prefetch, | ||
1654 | 311 | ) | ||
1655 | 312 | |||
1656 | 313 | request.send() | ||
1657 | 314 | r = request.response | ||
1658 | 315 | |||
1659 | 316 | r.history = history | ||
1660 | 317 | |||
1661 | 318 | self.response = r | ||
1662 | 319 | self.response.request = self | ||
1663 | 320 | |||
1664 | 321 | @staticmethod | ||
1665 | 322 | def _encode_params(data): | ||
1666 | 323 | """Encode parameters in a piece of data. | ||
1667 | 324 | |||
1668 | 325 | Will successfully encode parameters when passed as a dict or a list of | ||
1669 | 326 | 2-tuples. Order is retained if data is a list of 2-tuples but abritrary | ||
1670 | 327 | if parameters are supplied as a dict. | ||
1671 | 328 | """ | ||
1672 | 329 | |||
1673 | 330 | if isinstance(data, (str, bytes)): | ||
1674 | 331 | return data | ||
1675 | 332 | elif hasattr(data, 'read'): | ||
1676 | 333 | return data | ||
1677 | 334 | elif hasattr(data, '__iter__'): | ||
1678 | 335 | result = [] | ||
1679 | 336 | for k, vs in to_key_val_list(data): | ||
1680 | 337 | for v in isinstance(vs, list) and vs or [vs]: | ||
1681 | 338 | if v is not None: | ||
1682 | 339 | result.append( | ||
1683 | 340 | (k.encode('utf-8') if isinstance(k, str) else k, | ||
1684 | 341 | v.encode('utf-8') if isinstance(v, str) else v)) | ||
1685 | 342 | return urlencode(result, doseq=True) | ||
1686 | 343 | else: | ||
1687 | 344 | return data | ||
1688 | 345 | |||
1689 | 346 | def _encode_files(self, files): | ||
1690 | 347 | """Build the body for a multipart/form-data request. | ||
1691 | 348 | |||
1692 | 349 | Will successfully encode files when passed as a dict or a list of | ||
1693 | 350 | 2-tuples. Order is retained if data is a list of 2-tuples but abritrary | ||
1694 | 351 | if parameters are supplied as a dict. | ||
1695 | 352 | |||
1696 | 353 | """ | ||
1697 | 354 | if (not files) or isinstance(self.data, str): | ||
1698 | 355 | return None | ||
1699 | 356 | |||
1700 | 357 | new_fields = [] | ||
1701 | 358 | fields = to_key_val_list(self.data) | ||
1702 | 359 | files = to_key_val_list(files) | ||
1703 | 360 | |||
1704 | 361 | for field, val in fields: | ||
1705 | 362 | if isinstance(val, list): | ||
1706 | 363 | for v in val: | ||
1707 | 364 | new_fields.append((field, builtin_str(v))) | ||
1708 | 365 | else: | ||
1709 | 366 | new_fields.append((field, builtin_str(val))) | ||
1710 | 367 | |||
1711 | 368 | for (k, v) in files: | ||
1712 | 369 | # support for explicit filename | ||
1713 | 370 | if isinstance(v, (tuple, list)): | ||
1714 | 371 | fn, fp = v | ||
1715 | 372 | else: | ||
1716 | 373 | fn = guess_filename(v) or k | ||
1717 | 374 | fp = v | ||
1718 | 375 | if isinstance(fp, str): | ||
1719 | 376 | fp = StringIO(fp) | ||
1720 | 377 | if isinstance(fp, bytes): | ||
1721 | 378 | fp = BytesIO(fp) | ||
1722 | 379 | new_fields.append((k, (fn, fp.read()))) | ||
1723 | 380 | |||
1724 | 381 | body, content_type = encode_multipart_formdata(new_fields) | ||
1725 | 382 | |||
1726 | 383 | return body, content_type | ||
1727 | 384 | |||
1728 | 385 | @property | ||
1729 | 386 | def full_url(self): | ||
1730 | 387 | """Build the actual URL to use.""" | ||
1731 | 388 | |||
1732 | 389 | if not self.url: | ||
1733 | 390 | raise URLRequired() | ||
1734 | 391 | |||
1735 | 392 | url = self.url | ||
1736 | 393 | |||
1737 | 394 | # Support for unicode domain names and paths. | ||
1738 | 395 | scheme, netloc, path, params, query, fragment = urlparse(url) | ||
1739 | 396 | |||
1740 | 397 | if not scheme: | ||
1741 | 398 | raise MissingSchema("Invalid URL %r: No schema supplied" % url) | ||
1742 | 399 | |||
1743 | 400 | if not scheme in SCHEMAS: | ||
1744 | 401 | raise InvalidSchema("Invalid scheme %r" % scheme) | ||
1745 | 402 | |||
1746 | 403 | try: | ||
1747 | 404 | netloc = netloc.encode('idna').decode('utf-8') | ||
1748 | 405 | except UnicodeError: | ||
1749 | 406 | raise InvalidURL('URL has an invalid label.') | ||
1750 | 407 | |||
1751 | 408 | if not path: | ||
1752 | 409 | path = '/' | ||
1753 | 410 | |||
1754 | 411 | if is_py2: | ||
1755 | 412 | if isinstance(scheme, str): | ||
1756 | 413 | scheme = scheme.encode('utf-8') | ||
1757 | 414 | if isinstance(netloc, str): | ||
1758 | 415 | netloc = netloc.encode('utf-8') | ||
1759 | 416 | if isinstance(path, str): | ||
1760 | 417 | path = path.encode('utf-8') | ||
1761 | 418 | if isinstance(params, str): | ||
1762 | 419 | params = params.encode('utf-8') | ||
1763 | 420 | if isinstance(query, str): | ||
1764 | 421 | query = query.encode('utf-8') | ||
1765 | 422 | if isinstance(fragment, str): | ||
1766 | 423 | fragment = fragment.encode('utf-8') | ||
1767 | 424 | |||
1768 | 425 | enc_params = self._encode_params(self.params) | ||
1769 | 426 | if enc_params: | ||
1770 | 427 | if query: | ||
1771 | 428 | query = '%s&%s' % (query, enc_params) | ||
1772 | 429 | else: | ||
1773 | 430 | query = enc_params | ||
1774 | 431 | |||
1775 | 432 | url = (urlunparse([scheme, netloc, path, params, query, fragment])) | ||
1776 | 433 | |||
1777 | 434 | if self.config.get('encode_uri', True): | ||
1778 | 435 | url = requote_uri(url) | ||
1779 | 436 | |||
1780 | 437 | return url | ||
1781 | 438 | |||
1782 | 439 | @property | ||
1783 | 440 | def path_url(self): | ||
1784 | 441 | """Build the path URL to use.""" | ||
1785 | 442 | |||
1786 | 443 | url = [] | ||
1787 | 444 | |||
1788 | 445 | p = urlsplit(self.full_url) | ||
1789 | 446 | |||
1790 | 447 | # Proxies use full URLs. | ||
1791 | 448 | if p.scheme in self.proxies: | ||
1792 | 449 | url_base, frag = urldefrag(self.full_url) | ||
1793 | 450 | return url_base | ||
1794 | 451 | |||
1795 | 452 | |||
1796 | 453 | path = p.path | ||
1797 | 454 | if not path: | ||
1798 | 455 | path = '/' | ||
1799 | 456 | |||
1800 | 457 | url.append(path) | ||
1801 | 458 | |||
1802 | 459 | query = p.query | ||
1803 | 460 | if query: | ||
1804 | 461 | url.append('?') | ||
1805 | 462 | url.append(query) | ||
1806 | 463 | |||
1807 | 464 | return ''.join(url) | ||
1808 | 465 | |||
1809 | 466 | def register_hook(self, event, hook): | ||
1810 | 467 | """Properly register a hook.""" | ||
1811 | 468 | if callable(hook): | ||
1812 | 469 | self.hooks[event].append(hook) | ||
1813 | 470 | elif hasattr(hook, '__iter__'): | ||
1814 | 471 | self.hooks[event].extend(h for h in hook if callable(h)) | ||
1815 | 472 | |||
1816 | 473 | def deregister_hook(self, event, hook): | ||
1817 | 474 | """Deregister a previously registered hook. | ||
1818 | 475 | Returns True if the hook existed, False if not. | ||
1819 | 476 | """ | ||
1820 | 477 | |||
1821 | 478 | try: | ||
1822 | 479 | self.hooks[event].remove(hook) | ||
1823 | 480 | return True | ||
1824 | 481 | except ValueError: | ||
1825 | 482 | return False | ||
1826 | 483 | |||
1827 | 484 | def send(self, anyway=False, prefetch=None): | ||
1828 | 485 | """Sends the request. Returns True if successful, False if not. | ||
1829 | 486 | If there was an HTTPError during transmission, | ||
1830 | 487 | self.response.status_code will contain the HTTPError code. | ||
1831 | 488 | |||
1832 | 489 | Once a request is successfully sent, `sent` will equal True. | ||
1833 | 490 | |||
1834 | 491 | :param anyway: If True, request will be sent, even if it has | ||
1835 | 492 | already been sent. | ||
1836 | 493 | |||
1837 | 494 | :param prefetch: If not None, will override the request's own setting | ||
1838 | 495 | for prefetch. | ||
1839 | 496 | """ | ||
1840 | 497 | |||
1841 | 498 | # Build the URL | ||
1842 | 499 | url = self.full_url | ||
1843 | 500 | |||
1844 | 501 | # Pre-request hook. | ||
1845 | 502 | r = dispatch_hook('pre_request', self.hooks, self) | ||
1846 | 503 | self.__dict__.update(r.__dict__) | ||
1847 | 504 | |||
1848 | 505 | # Logging | ||
1849 | 506 | if self.config.get('verbose'): | ||
1850 | 507 | self.config.get('verbose').write('%s %s %s\n' % ( | ||
1851 | 508 | datetime.now().isoformat(), self.method, url | ||
1852 | 509 | )) | ||
1853 | 510 | |||
1854 | 511 | # Use .netrc auth if none was provided. | ||
1855 | 512 | if not self.auth and self.config.get('trust_env'): | ||
1856 | 513 | self.auth = get_netrc_auth(url) | ||
1857 | 514 | |||
1858 | 515 | if self.auth: | ||
1859 | 516 | if isinstance(self.auth, tuple) and len(self.auth) == 2: | ||
1860 | 517 | # special-case basic HTTP auth | ||
1861 | 518 | self.auth = HTTPBasicAuth(*self.auth) | ||
1862 | 519 | |||
1863 | 520 | # Allow auth to make its changes. | ||
1864 | 521 | r = self.auth(self) | ||
1865 | 522 | |||
1866 | 523 | # Update self to reflect the auth changes. | ||
1867 | 524 | self.__dict__.update(r.__dict__) | ||
1868 | 525 | |||
1869 | 526 | # Nottin' on you. | ||
1870 | 527 | body = None | ||
1871 | 528 | content_type = None | ||
1872 | 529 | |||
1873 | 530 | # Multi-part file uploads. | ||
1874 | 531 | if self.files: | ||
1875 | 532 | (body, content_type) = self._encode_files(self.files) | ||
1876 | 533 | else: | ||
1877 | 534 | if self.data: | ||
1878 | 535 | |||
1879 | 536 | body = self._encode_params(self.data) | ||
1880 | 537 | if isinstance(self.data, str) or isinstance(self.data, builtin_str) or hasattr(self.data, 'read'): | ||
1881 | 538 | content_type = None | ||
1882 | 539 | else: | ||
1883 | 540 | content_type = 'application/x-www-form-urlencoded' | ||
1884 | 541 | |||
1885 | 542 | # Add content-type if it wasn't explicitly provided. | ||
1886 | 543 | if (content_type) and (not 'content-type' in self.headers): | ||
1887 | 544 | self.headers['Content-Type'] = content_type | ||
1888 | 545 | |||
1889 | 546 | _p = urlparse(url) | ||
1890 | 547 | no_proxy = filter(lambda x: x.strip(), self.proxies.get('no', '').split(',')) | ||
1891 | 548 | proxy = self.proxies.get(_p.scheme) | ||
1892 | 549 | |||
1893 | 550 | if proxy and not any(map(_p.hostname.endswith, no_proxy)): | ||
1894 | 551 | conn = poolmanager.proxy_from_url(proxy) | ||
1895 | 552 | _proxy = urlparse(proxy) | ||
1896 | 553 | if '@' in _proxy.netloc: | ||
1897 | 554 | auth, url = _proxy.netloc.split('@', 1) | ||
1898 | 555 | self.proxy_auth = HTTPProxyAuth(*auth.split(':', 1)) | ||
1899 | 556 | r = self.proxy_auth(self) | ||
1900 | 557 | self.__dict__.update(r.__dict__) | ||
1901 | 558 | else: | ||
1902 | 559 | # Check to see if keep_alive is allowed. | ||
1903 | 560 | try: | ||
1904 | 561 | if self.config.get('keep_alive'): | ||
1905 | 562 | conn = self._poolmanager.connection_from_url(url) | ||
1906 | 563 | else: | ||
1907 | 564 | conn = connectionpool.connection_from_url(url) | ||
1908 | 565 | self.headers['Connection'] = 'close' | ||
1909 | 566 | except LocationParseError as e: | ||
1910 | 567 | raise InvalidURL(e) | ||
1911 | 568 | |||
1912 | 569 | if url.startswith('https') and self.verify: | ||
1913 | 570 | |||
1914 | 571 | cert_loc = None | ||
1915 | 572 | |||
1916 | 573 | # Allow self-specified cert location. | ||
1917 | 574 | if self.verify is not True: | ||
1918 | 575 | cert_loc = self.verify | ||
1919 | 576 | |||
1920 | 577 | # Look for configuration. | ||
1921 | 578 | if not cert_loc and self.config.get('trust_env'): | ||
1922 | 579 | cert_loc = os.environ.get('REQUESTS_CA_BUNDLE') | ||
1923 | 580 | |||
1924 | 581 | # Curl compatibility. | ||
1925 | 582 | if not cert_loc and self.config.get('trust_env'): | ||
1926 | 583 | cert_loc = os.environ.get('CURL_CA_BUNDLE') | ||
1927 | 584 | |||
1928 | 585 | if not cert_loc: | ||
1929 | 586 | cert_loc = DEFAULT_CA_BUNDLE_PATH | ||
1930 | 587 | |||
1931 | 588 | if not cert_loc: | ||
1932 | 589 | raise Exception("Could not find a suitable SSL CA certificate bundle.") | ||
1933 | 590 | |||
1934 | 591 | conn.cert_reqs = 'CERT_REQUIRED' | ||
1935 | 592 | conn.ca_certs = cert_loc | ||
1936 | 593 | else: | ||
1937 | 594 | conn.cert_reqs = 'CERT_NONE' | ||
1938 | 595 | conn.ca_certs = None | ||
1939 | 596 | |||
1940 | 597 | if self.cert: | ||
1941 | 598 | if len(self.cert) == 2: | ||
1942 | 599 | conn.cert_file = self.cert[0] | ||
1943 | 600 | conn.key_file = self.cert[1] | ||
1944 | 601 | else: | ||
1945 | 602 | conn.cert_file = self.cert | ||
1946 | 603 | |||
1947 | 604 | if not self.sent or anyway: | ||
1948 | 605 | |||
1949 | 606 | # Skip if 'cookie' header is explicitly set. | ||
1950 | 607 | if 'cookie' not in self.headers: | ||
1951 | 608 | cookie_header = get_cookie_header(self.cookies, self) | ||
1952 | 609 | if cookie_header is not None: | ||
1953 | 610 | self.headers['Cookie'] = cookie_header | ||
1954 | 611 | |||
1955 | 612 | # Pre-send hook. | ||
1956 | 613 | r = dispatch_hook('pre_send', self.hooks, self) | ||
1957 | 614 | self.__dict__.update(r.__dict__) | ||
1958 | 615 | |||
1959 | 616 | # catch urllib3 exceptions and throw Requests exceptions | ||
1960 | 617 | try: | ||
1961 | 618 | # Send the request. | ||
1962 | 619 | r = conn.urlopen( | ||
1963 | 620 | method=self.method, | ||
1964 | 621 | url=self.path_url, | ||
1965 | 622 | body=body, | ||
1966 | 623 | headers=self.headers, | ||
1967 | 624 | redirect=False, | ||
1968 | 625 | assert_same_host=False, | ||
1969 | 626 | preload_content=False, | ||
1970 | 627 | decode_content=False, | ||
1971 | 628 | retries=self.config.get('max_retries', 0), | ||
1972 | 629 | timeout=self.timeout, | ||
1973 | 630 | ) | ||
1974 | 631 | self.sent = True | ||
1975 | 632 | |||
1976 | 633 | except socket.error as sockerr: | ||
1977 | 634 | raise ConnectionError(sockerr) | ||
1978 | 635 | |||
1979 | 636 | except MaxRetryError as e: | ||
1980 | 637 | raise ConnectionError(e) | ||
1981 | 638 | |||
1982 | 639 | except (_SSLError, _HTTPError) as e: | ||
1983 | 640 | if isinstance(e, _SSLError): | ||
1984 | 641 | raise SSLError(e) | ||
1985 | 642 | elif isinstance(e, TimeoutError): | ||
1986 | 643 | raise Timeout(e) | ||
1987 | 644 | else: | ||
1988 | 645 | raise Timeout('Request timed out.') | ||
1989 | 646 | |||
1990 | 647 | # build_response can throw TooManyRedirects | ||
1991 | 648 | self._build_response(r) | ||
1992 | 649 | |||
1993 | 650 | # Response manipulation hook. | ||
1994 | 651 | self.response = dispatch_hook('response', self.hooks, self.response) | ||
1995 | 652 | |||
1996 | 653 | # Post-request hook. | ||
1997 | 654 | r = dispatch_hook('post_request', self.hooks, self) | ||
1998 | 655 | self.__dict__.update(r.__dict__) | ||
1999 | 656 | |||
2000 | 657 | # If prefetch is True, mark content as consumed. | ||
2001 | 658 | if prefetch is None: | ||
2002 | 659 | prefetch = self.prefetch | ||
2003 | 660 | if prefetch: | ||
2004 | 661 | # Save the response. | ||
2005 | 662 | self.response.content | ||
2006 | 663 | |||
2007 | 664 | if self.config.get('danger_mode'): | ||
2008 | 665 | self.response.raise_for_status() | ||
2009 | 666 | |||
2010 | 667 | return self.sent | ||
2011 | 668 | |||
2012 | 669 | |||
2013 | 670 | class Response(object): | ||
2014 | 671 | """The core :class:`Response <Response>` object. All | ||
2015 | 672 | :class:`Request <Request>` objects contain a | ||
2016 | 673 | :class:`response <Response>` attribute, which is an instance | ||
2017 | 674 | of this class. | ||
2018 | 675 | """ | ||
2019 | 676 | |||
2020 | 677 | def __init__(self): | ||
2021 | 678 | |||
2022 | 679 | self._content = False | ||
2023 | 680 | self._content_consumed = False | ||
2024 | 681 | |||
2025 | 682 | #: Integer Code of responded HTTP Status. | ||
2026 | 683 | self.status_code = None | ||
2027 | 684 | |||
2028 | 685 | #: Case-insensitive Dictionary of Response Headers. | ||
2029 | 686 | #: For example, ``headers['content-encoding']`` will return the | ||
2030 | 687 | #: value of a ``'Content-Encoding'`` response header. | ||
2031 | 688 | self.headers = CaseInsensitiveDict() | ||
2032 | 689 | |||
2033 | 690 | #: File-like object representation of response (for advanced usage). | ||
2034 | 691 | self.raw = None | ||
2035 | 692 | |||
2036 | 693 | #: Final URL location of Response. | ||
2037 | 694 | self.url = None | ||
2038 | 695 | |||
2039 | 696 | #: Resulting :class:`HTTPError` of request, if one occurred. | ||
2040 | 697 | self.error = None | ||
2041 | 698 | |||
2042 | 699 | #: Encoding to decode with when accessing r.text. | ||
2043 | 700 | self.encoding = None | ||
2044 | 701 | |||
2045 | 702 | #: A list of :class:`Response <Response>` objects from | ||
2046 | 703 | #: the history of the Request. Any redirect responses will end | ||
2047 | 704 | #: up here. The list is sorted from the oldest to the most recent request. | ||
2048 | 705 | self.history = [] | ||
2049 | 706 | |||
2050 | 707 | #: The :class:`Request <Request>` that created the Response. | ||
2051 | 708 | self.request = None | ||
2052 | 709 | |||
2053 | 710 | #: A CookieJar of Cookies the server sent back. | ||
2054 | 711 | self.cookies = None | ||
2055 | 712 | |||
2056 | 713 | #: Dictionary of configurations for this request. | ||
2057 | 714 | self.config = {} | ||
2058 | 715 | |||
2059 | 716 | def __repr__(self): | ||
2060 | 717 | return '<Response [%s]>' % (self.status_code) | ||
2061 | 718 | |||
2062 | 719 | def __bool__(self): | ||
2063 | 720 | """Returns true if :attr:`status_code` is 'OK'.""" | ||
2064 | 721 | return self.ok | ||
2065 | 722 | |||
2066 | 723 | def __nonzero__(self): | ||
2067 | 724 | """Returns true if :attr:`status_code` is 'OK'.""" | ||
2068 | 725 | return self.ok | ||
2069 | 726 | |||
2070 | 727 | @property | ||
2071 | 728 | def ok(self): | ||
2072 | 729 | try: | ||
2073 | 730 | self.raise_for_status() | ||
2074 | 731 | except RequestException: | ||
2075 | 732 | return False | ||
2076 | 733 | return True | ||
2077 | 734 | |||
2078 | 735 | def iter_content(self, chunk_size=1, decode_unicode=False): | ||
2079 | 736 | """Iterates over the response data. This avoids reading the content | ||
2080 | 737 | at once into memory for large responses. The chunk size is the number | ||
2081 | 738 | of bytes it should read into memory. This is not necessarily the | ||
2082 | 739 | length of each item returned as decoding can take place. | ||
2083 | 740 | """ | ||
2084 | 741 | if self._content_consumed: | ||
2085 | 742 | # simulate reading small chunks of the content | ||
2086 | 743 | return iter_slices(self._content, chunk_size) | ||
2087 | 744 | |||
2088 | 745 | def generate(): | ||
2089 | 746 | while 1: | ||
2090 | 747 | chunk = self.raw.read(chunk_size) | ||
2091 | 748 | if not chunk: | ||
2092 | 749 | break | ||
2093 | 750 | yield chunk | ||
2094 | 751 | self._content_consumed = True | ||
2095 | 752 | |||
2096 | 753 | gen = stream_untransfer(generate(), self) | ||
2097 | 754 | |||
2098 | 755 | if decode_unicode: | ||
2099 | 756 | gen = stream_decode_response_unicode(gen, self) | ||
2100 | 757 | |||
2101 | 758 | return gen | ||
2102 | 759 | |||
2103 | 760 | def iter_lines(self, chunk_size=10 * 1024, decode_unicode=None): | ||
2104 | 761 | """Iterates over the response data, one line at a time. This | ||
2105 | 762 | avoids reading the content at once into memory for large | ||
2106 | 763 | responses. | ||
2107 | 764 | """ | ||
2108 | 765 | |||
2109 | 766 | pending = None | ||
2110 | 767 | |||
2111 | 768 | for chunk in self.iter_content( | ||
2112 | 769 | chunk_size=chunk_size, | ||
2113 | 770 | decode_unicode=decode_unicode): | ||
2114 | 771 | |||
2115 | 772 | if pending is not None: | ||
2116 | 773 | chunk = pending + chunk | ||
2117 | 774 | lines = chunk.splitlines() | ||
2118 | 775 | |||
2119 | 776 | if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]: | ||
2120 | 777 | pending = lines.pop() | ||
2121 | 778 | else: | ||
2122 | 779 | pending = None | ||
2123 | 780 | |||
2124 | 781 | for line in lines: | ||
2125 | 782 | yield line | ||
2126 | 783 | |||
2127 | 784 | if pending is not None: | ||
2128 | 785 | yield pending | ||
2129 | 786 | |||
2130 | 787 | @property | ||
2131 | 788 | def content(self): | ||
2132 | 789 | """Content of the response, in bytes.""" | ||
2133 | 790 | |||
2134 | 791 | if self._content is False: | ||
2135 | 792 | # Read the contents. | ||
2136 | 793 | try: | ||
2137 | 794 | if self._content_consumed: | ||
2138 | 795 | raise RuntimeError( | ||
2139 | 796 | 'The content for this response was already consumed') | ||
2140 | 797 | |||
2141 | 798 | if self.status_code is 0: | ||
2142 | 799 | self._content = None | ||
2143 | 800 | else: | ||
2144 | 801 | self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes() | ||
2145 | 802 | |||
2146 | 803 | except AttributeError: | ||
2147 | 804 | self._content = None | ||
2148 | 805 | |||
2149 | 806 | self._content_consumed = True | ||
2150 | 807 | # don't need to release the connection; that's been handled by urllib3 | ||
2151 | 808 | # since we exhausted the data. | ||
2152 | 809 | return self._content | ||
2153 | 810 | |||
2154 | 811 | @property | ||
2155 | 812 | def text(self): | ||
2156 | 813 | """Content of the response, in unicode. | ||
2157 | 814 | |||
2158 | 815 | if Response.encoding is None and chardet module is available, encoding | ||
2159 | 816 | will be guessed. | ||
2160 | 817 | """ | ||
2161 | 818 | |||
2162 | 819 | # Try charset from content-type | ||
2163 | 820 | content = None | ||
2164 | 821 | encoding = self.encoding | ||
2165 | 822 | |||
2166 | 823 | if not self.content: | ||
2167 | 824 | return str('') | ||
2168 | 825 | |||
2169 | 826 | # Fallback to auto-detected encoding. | ||
2170 | 827 | if self.encoding is None: | ||
2171 | 828 | if chardet is not None: | ||
2172 | 829 | encoding = chardet.detect(self.content)['encoding'] | ||
2173 | 830 | |||
2174 | 831 | # Decode unicode from given encoding. | ||
2175 | 832 | try: | ||
2176 | 833 | content = str(self.content, encoding, errors='replace') | ||
2177 | 834 | except (LookupError, TypeError): | ||
2178 | 835 | # A LookupError is raised if the encoding was not found which could | ||
2179 | 836 | # indicate a misspelling or similar mistake. | ||
2180 | 837 | # | ||
2181 | 838 | # A TypeError can be raised if encoding is None | ||
2182 | 839 | # | ||
2183 | 840 | # So we try blindly encoding. | ||
2184 | 841 | content = str(self.content, errors='replace') | ||
2185 | 842 | |||
2186 | 843 | return content | ||
2187 | 844 | |||
2188 | 845 | @property | ||
2189 | 846 | def json(self): | ||
2190 | 847 | """Returns the json-encoded content of a response, if any.""" | ||
2191 | 848 | |||
2192 | 849 | if not self.encoding and len(self.content) > 3: | ||
2193 | 850 | # No encoding set. JSON RFC 4627 section 3 states we should expect | ||
2194 | 851 | # UTF-8, -16 or -32. Detect which one to use; If the detection or | ||
2195 | 852 | # decoding fails, fall back to `self.text` (using chardet to make | ||
2196 | 853 | # a best guess). | ||
2197 | 854 | encoding = guess_json_utf(self.content) | ||
2198 | 855 | if encoding is not None: | ||
2199 | 856 | try: | ||
2200 | 857 | return json.loads(self.content.decode(encoding)) | ||
2201 | 858 | except (ValueError, UnicodeDecodeError): | ||
2202 | 859 | pass | ||
2203 | 860 | try: | ||
2204 | 861 | return json.loads(self.text or self.content) | ||
2205 | 862 | except ValueError: | ||
2206 | 863 | return None | ||
2207 | 864 | |||
2208 | 865 | @property | ||
2209 | 866 | def links(self): | ||
2210 | 867 | """Returns the parsed header links of the response, if any.""" | ||
2211 | 868 | |||
2212 | 869 | header = self.headers['link'] | ||
2213 | 870 | |||
2214 | 871 | # l = MultiDict() | ||
2215 | 872 | l = {} | ||
2216 | 873 | |||
2217 | 874 | if header: | ||
2218 | 875 | links = parse_header_links(header) | ||
2219 | 876 | |||
2220 | 877 | for link in links: | ||
2221 | 878 | key = link.get('rel') or link.get('url') | ||
2222 | 879 | l[key] = link | ||
2223 | 880 | |||
2224 | 881 | return l | ||
2225 | 882 | |||
2226 | 883 | @property | ||
2227 | 884 | def reason(self): | ||
2228 | 885 | """The HTTP Reason for the response.""" | ||
2229 | 886 | return self.raw.reason | ||
2230 | 887 | |||
2231 | 888 | def raise_for_status(self, allow_redirects=True): | ||
2232 | 889 | """Raises stored :class:`HTTPError` or :class:`URLError`, if one occurred.""" | ||
2233 | 890 | |||
2234 | 891 | if self.error: | ||
2235 | 892 | raise self.error | ||
2236 | 893 | |||
2237 | 894 | http_error_msg = '' | ||
2238 | 895 | if 300 <= self.status_code < 400 and not allow_redirects: | ||
2239 | 896 | http_error_msg = '%s Redirection: %s' % (self.status_code, self.reason) | ||
2240 | 897 | |||
2241 | 898 | elif 400 <= self.status_code < 500: | ||
2242 | 899 | http_error_msg = '%s Client Error: %s' % (self.status_code, self.reason) | ||
2243 | 900 | |||
2244 | 901 | elif 500 <= self.status_code < 600: | ||
2245 | 902 | http_error_msg = '%s Server Error: %s' % (self.status_code, self.reason) | ||
2246 | 903 | |||
2247 | 904 | if http_error_msg: | ||
2248 | 905 | http_error = HTTPError(http_error_msg) | ||
2249 | 906 | http_error.response = self | ||
2250 | 907 | raise http_error | ||
2251 | 0 | 908 | ||
2252 | === added directory '.pc/03-use-distro-packages.patch/requests/packages' | |||
2253 | === added file '.pc/03-use-distro-packages.patch/requests/packages/__init__.py' | |||
2254 | --- .pc/03-use-distro-packages.patch/requests/packages/__init__.py 1970-01-01 00:00:00 +0000 | |||
2255 | +++ .pc/03-use-distro-packages.patch/requests/packages/__init__.py 2013-01-28 21:06:46 +0000 | |||
2256 | @@ -0,0 +1,3 @@ | |||
2257 | 1 | from __future__ import absolute_import | ||
2258 | 2 | |||
2259 | 3 | from . import urllib3 | ||
2260 | 0 | 4 | ||
2261 | === added file '.pc/03-use-distro-packages.patch/requests/safe_mode.py' | |||
2262 | --- .pc/03-use-distro-packages.patch/requests/safe_mode.py 1970-01-01 00:00:00 +0000 | |||
2263 | +++ .pc/03-use-distro-packages.patch/requests/safe_mode.py 2013-01-28 21:06:46 +0000 | |||
2264 | @@ -0,0 +1,40 @@ | |||
2265 | 1 | # -*- coding: utf-8 -*- | ||
2266 | 2 | |||
2267 | 3 | """ | ||
2268 | 4 | requests.safe_mode | ||
2269 | 5 | ~~~~~~~~~~~~ | ||
2270 | 6 | |||
2271 | 7 | This module contains a decorator that implements safe_mode. | ||
2272 | 8 | |||
2273 | 9 | :copyright: (c) 2012 by Kenneth Reitz. | ||
2274 | 10 | :license: ISC, see LICENSE for more details. | ||
2275 | 11 | |||
2276 | 12 | """ | ||
2277 | 13 | |||
2278 | 14 | from .models import Response | ||
2279 | 15 | from .packages.urllib3.response import HTTPResponse | ||
2280 | 16 | from .exceptions import RequestException, ConnectionError, HTTPError | ||
2281 | 17 | import socket | ||
2282 | 18 | |||
2283 | 19 | |||
2284 | 20 | def catch_exceptions_if_in_safe_mode(function): | ||
2285 | 21 | """New implementation of safe_mode. We catch all exceptions at the API level | ||
2286 | 22 | and then return a blank Response object with the error field filled. This decorator | ||
2287 | 23 | wraps request() in api.py. | ||
2288 | 24 | """ | ||
2289 | 25 | |||
2290 | 26 | def wrapped(method, url, **kwargs): | ||
2291 | 27 | # if save_mode, we catch exceptions and fill error field | ||
2292 | 28 | if (kwargs.get('config') and kwargs.get('config').get('safe_mode')) or (kwargs.get('session') | ||
2293 | 29 | and kwargs.get('session').config.get('safe_mode')): | ||
2294 | 30 | try: | ||
2295 | 31 | return function(method, url, **kwargs) | ||
2296 | 32 | except (RequestException, ConnectionError, HTTPError, | ||
2297 | 33 | socket.timeout, socket.gaierror) as e: | ||
2298 | 34 | r = Response() | ||
2299 | 35 | r.error = e | ||
2300 | 36 | r.raw = HTTPResponse() # otherwise, tests fail | ||
2301 | 37 | r.status_code = 0 # with this status_code, content returns None | ||
2302 | 38 | return r | ||
2303 | 39 | return function(method, url, **kwargs) | ||
2304 | 40 | return wrapped | ||
2305 | 0 | 41 | ||
2306 | === added file '.pc/03-use-distro-packages.patch/requests/sessions.py' | |||
2307 | --- .pc/03-use-distro-packages.patch/requests/sessions.py 1970-01-01 00:00:00 +0000 | |||
2308 | +++ .pc/03-use-distro-packages.patch/requests/sessions.py 2013-01-28 21:06:46 +0000 | |||
2309 | @@ -0,0 +1,328 @@ | |||
2310 | 1 | # -*- coding: utf-8 -*- | ||
2311 | 2 | |||
2312 | 3 | """ | ||
2313 | 4 | requests.session | ||
2314 | 5 | ~~~~~~~~~~~~~~~~ | ||
2315 | 6 | |||
2316 | 7 | This module provides a Session object to manage and persist settings across | ||
2317 | 8 | requests (cookies, auth, proxies). | ||
2318 | 9 | |||
2319 | 10 | """ | ||
2320 | 11 | |||
2321 | 12 | from copy import deepcopy | ||
2322 | 13 | from .compat import cookielib | ||
2323 | 14 | from .cookies import cookiejar_from_dict, remove_cookie_by_name | ||
2324 | 15 | from .defaults import defaults | ||
2325 | 16 | from .models import Request | ||
2326 | 17 | from .hooks import dispatch_hook | ||
2327 | 18 | from .utils import header_expand, from_key_val_list | ||
2328 | 19 | from .packages.urllib3.poolmanager import PoolManager | ||
2329 | 20 | |||
2330 | 21 | |||
2331 | 22 | def merge_kwargs(local_kwarg, default_kwarg): | ||
2332 | 23 | """Merges kwarg dictionaries. | ||
2333 | 24 | |||
2334 | 25 | If a local key in the dictionary is set to None, it will be removed. | ||
2335 | 26 | """ | ||
2336 | 27 | |||
2337 | 28 | if default_kwarg is None: | ||
2338 | 29 | return local_kwarg | ||
2339 | 30 | |||
2340 | 31 | if isinstance(local_kwarg, str): | ||
2341 | 32 | return local_kwarg | ||
2342 | 33 | |||
2343 | 34 | if local_kwarg is None: | ||
2344 | 35 | return default_kwarg | ||
2345 | 36 | |||
2346 | 37 | # Bypass if not a dictionary (e.g. timeout) | ||
2347 | 38 | if not hasattr(default_kwarg, 'items'): | ||
2348 | 39 | return local_kwarg | ||
2349 | 40 | |||
2350 | 41 | default_kwarg = from_key_val_list(default_kwarg) | ||
2351 | 42 | local_kwarg = from_key_val_list(local_kwarg) | ||
2352 | 43 | |||
2353 | 44 | # Update new values. | ||
2354 | 45 | kwargs = default_kwarg.copy() | ||
2355 | 46 | kwargs.update(local_kwarg) | ||
2356 | 47 | |||
2357 | 48 | # Remove keys that are set to None. | ||
2358 | 49 | for (k, v) in local_kwarg.items(): | ||
2359 | 50 | if v is None: | ||
2360 | 51 | del kwargs[k] | ||
2361 | 52 | |||
2362 | 53 | return kwargs | ||
2363 | 54 | |||
2364 | 55 | |||
2365 | 56 | class Session(object): | ||
2366 | 57 | """A Requests session.""" | ||
2367 | 58 | |||
2368 | 59 | __attrs__ = [ | ||
2369 | 60 | 'headers', 'cookies', 'auth', 'timeout', 'proxies', 'hooks', | ||
2370 | 61 | 'params', 'config', 'verify', 'cert', 'prefetch'] | ||
2371 | 62 | |||
2372 | 63 | def __init__(self, | ||
2373 | 64 | headers=None, | ||
2374 | 65 | cookies=None, | ||
2375 | 66 | auth=None, | ||
2376 | 67 | timeout=None, | ||
2377 | 68 | proxies=None, | ||
2378 | 69 | hooks=None, | ||
2379 | 70 | params=None, | ||
2380 | 71 | config=None, | ||
2381 | 72 | prefetch=True, | ||
2382 | 73 | verify=True, | ||
2383 | 74 | cert=None): | ||
2384 | 75 | |||
2385 | 76 | self.headers = from_key_val_list(headers or []) | ||
2386 | 77 | self.auth = auth | ||
2387 | 78 | self.timeout = timeout | ||
2388 | 79 | self.proxies = from_key_val_list(proxies or []) | ||
2389 | 80 | self.hooks = from_key_val_list(hooks or {}) | ||
2390 | 81 | self.params = from_key_val_list(params or []) | ||
2391 | 82 | self.config = from_key_val_list(config or {}) | ||
2392 | 83 | self.prefetch = prefetch | ||
2393 | 84 | self.verify = verify | ||
2394 | 85 | self.cert = cert | ||
2395 | 86 | |||
2396 | 87 | for (k, v) in list(defaults.items()): | ||
2397 | 88 | self.config.setdefault(k, deepcopy(v)) | ||
2398 | 89 | |||
2399 | 90 | self.init_poolmanager() | ||
2400 | 91 | |||
2401 | 92 | # Set up a CookieJar to be used by default | ||
2402 | 93 | if isinstance(cookies, cookielib.CookieJar): | ||
2403 | 94 | self.cookies = cookies | ||
2404 | 95 | else: | ||
2405 | 96 | self.cookies = cookiejar_from_dict(cookies) | ||
2406 | 97 | |||
2407 | 98 | def init_poolmanager(self): | ||
2408 | 99 | self.poolmanager = PoolManager( | ||
2409 | 100 | num_pools=self.config.get('pool_connections'), | ||
2410 | 101 | maxsize=self.config.get('pool_maxsize') | ||
2411 | 102 | ) | ||
2412 | 103 | |||
2413 | 104 | def __repr__(self): | ||
2414 | 105 | return '<requests-client at 0x%x>' % (id(self)) | ||
2415 | 106 | |||
2416 | 107 | def __enter__(self): | ||
2417 | 108 | return self | ||
2418 | 109 | |||
2419 | 110 | def __exit__(self, *args): | ||
2420 | 111 | self.close() | ||
2421 | 112 | |||
2422 | 113 | def close(self): | ||
2423 | 114 | """Dispose of any internal state. | ||
2424 | 115 | |||
2425 | 116 | Currently, this just closes the PoolManager, which closes pooled | ||
2426 | 117 | connections. | ||
2427 | 118 | """ | ||
2428 | 119 | self.poolmanager.clear() | ||
2429 | 120 | |||
2430 | 121 | def request(self, method, url, | ||
2431 | 122 | params=None, | ||
2432 | 123 | data=None, | ||
2433 | 124 | headers=None, | ||
2434 | 125 | cookies=None, | ||
2435 | 126 | files=None, | ||
2436 | 127 | auth=None, | ||
2437 | 128 | timeout=None, | ||
2438 | 129 | allow_redirects=True, | ||
2439 | 130 | proxies=None, | ||
2440 | 131 | hooks=None, | ||
2441 | 132 | return_response=True, | ||
2442 | 133 | config=None, | ||
2443 | 134 | prefetch=None, | ||
2444 | 135 | verify=None, | ||
2445 | 136 | cert=None): | ||
2446 | 137 | |||
2447 | 138 | """Constructs and sends a :class:`Request <Request>`. | ||
2448 | 139 | Returns :class:`Response <Response>` object. | ||
2449 | 140 | |||
2450 | 141 | :param method: method for the new :class:`Request` object. | ||
2451 | 142 | :param url: URL for the new :class:`Request` object. | ||
2452 | 143 | :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. | ||
2453 | 144 | :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`. | ||
2454 | 145 | :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. | ||
2455 | 146 | :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. | ||
2456 | 147 | :param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload. | ||
2457 | 148 | :param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth. | ||
2458 | 149 | :param timeout: (optional) Float describing the timeout of the request. | ||
2459 | 150 | :param allow_redirects: (optional) Boolean. Set to True by default. | ||
2460 | 151 | :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. | ||
2461 | 152 | :param return_response: (optional) If False, an un-sent Request object will returned. | ||
2462 | 153 | :param config: (optional) A configuration dictionary. See ``request.defaults`` for allowed keys and their default values. | ||
2463 | 154 | :param prefetch: (optional) whether to immediately download the response content. Defaults to ``True``. | ||
2464 | 155 | :param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided. | ||
2465 | 156 | :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. | ||
2466 | 157 | """ | ||
2467 | 158 | |||
2468 | 159 | method = str(method).upper() | ||
2469 | 160 | |||
2470 | 161 | # Default empty dicts for dict params. | ||
2471 | 162 | data = [] if data is None else data | ||
2472 | 163 | files = [] if files is None else files | ||
2473 | 164 | headers = {} if headers is None else headers | ||
2474 | 165 | params = {} if params is None else params | ||
2475 | 166 | hooks = {} if hooks is None else hooks | ||
2476 | 167 | prefetch = prefetch if prefetch is not None else self.prefetch | ||
2477 | 168 | |||
2478 | 169 | # use session's hooks as defaults | ||
2479 | 170 | for key, cb in list(self.hooks.items()): | ||
2480 | 171 | hooks.setdefault(key, cb) | ||
2481 | 172 | |||
2482 | 173 | # Expand header values. | ||
2483 | 174 | if headers: | ||
2484 | 175 | for k, v in list(headers.items() or {}): | ||
2485 | 176 | headers[k] = header_expand(v) | ||
2486 | 177 | |||
2487 | 178 | args = dict( | ||
2488 | 179 | method=method, | ||
2489 | 180 | url=url, | ||
2490 | 181 | data=data, | ||
2491 | 182 | params=from_key_val_list(params), | ||
2492 | 183 | headers=from_key_val_list(headers), | ||
2493 | 184 | cookies=cookies, | ||
2494 | 185 | files=files, | ||
2495 | 186 | auth=auth, | ||
2496 | 187 | hooks=from_key_val_list(hooks), | ||
2497 | 188 | timeout=timeout, | ||
2498 | 189 | allow_redirects=allow_redirects, | ||
2499 | 190 | proxies=from_key_val_list(proxies), | ||
2500 | 191 | config=from_key_val_list(config), | ||
2501 | 192 | prefetch=prefetch, | ||
2502 | 193 | verify=verify, | ||
2503 | 194 | cert=cert, | ||
2504 | 195 | _poolmanager=self.poolmanager | ||
2505 | 196 | ) | ||
2506 | 197 | |||
2507 | 198 | # merge session cookies into passed-in ones | ||
2508 | 199 | dead_cookies = None | ||
2509 | 200 | # passed-in cookies must become a CookieJar: | ||
2510 | 201 | if not isinstance(cookies, cookielib.CookieJar): | ||
2511 | 202 | args['cookies'] = cookiejar_from_dict(cookies) | ||
2512 | 203 | # support unsetting cookies that have been passed in with None values | ||
2513 | 204 | # this is only meaningful when `cookies` is a dict --- | ||
2514 | 205 | # for a real CookieJar, the client should use session.cookies.clear() | ||
2515 | 206 | if cookies is not None: | ||
2516 | 207 | dead_cookies = [name for name in cookies if cookies[name] is None] | ||
2517 | 208 | # merge the session's cookies into the passed-in cookies: | ||
2518 | 209 | for cookie in self.cookies: | ||
2519 | 210 | args['cookies'].set_cookie(cookie) | ||
2520 | 211 | # remove the unset cookies from the jar we'll be using with the current request | ||
2521 | 212 | # (but not from the session's own store of cookies): | ||
2522 | 213 | if dead_cookies is not None: | ||
2523 | 214 | for name in dead_cookies: | ||
2524 | 215 | remove_cookie_by_name(args['cookies'], name) | ||
2525 | 216 | |||
2526 | 217 | # Merge local kwargs with session kwargs. | ||
2527 | 218 | for attr in self.__attrs__: | ||
2528 | 219 | # we already merged cookies: | ||
2529 | 220 | if attr == 'cookies': | ||
2530 | 221 | continue | ||
2531 | 222 | |||
2532 | 223 | session_val = getattr(self, attr, None) | ||
2533 | 224 | local_val = args.get(attr) | ||
2534 | 225 | args[attr] = merge_kwargs(local_val, session_val) | ||
2535 | 226 | |||
2536 | 227 | # Arguments manipulation hook. | ||
2537 | 228 | args = dispatch_hook('args', args['hooks'], args) | ||
2538 | 229 | |||
2539 | 230 | # Create the (empty) response. | ||
2540 | 231 | r = Request(**args) | ||
2541 | 232 | |||
2542 | 233 | # Give the response some context. | ||
2543 | 234 | r.session = self | ||
2544 | 235 | |||
2545 | 236 | # Don't send if asked nicely. | ||
2546 | 237 | if not return_response: | ||
2547 | 238 | return r | ||
2548 | 239 | |||
2549 | 240 | # Send the HTTP Request. | ||
2550 | 241 | r.send(prefetch=prefetch) | ||
2551 | 242 | |||
2552 | 243 | # Return the response. | ||
2553 | 244 | return r.response | ||
2554 | 245 | |||
2555 | 246 | def get(self, url, **kwargs): | ||
2556 | 247 | """Sends a GET request. Returns :class:`Response` object. | ||
2557 | 248 | |||
2558 | 249 | :param url: URL for the new :class:`Request` object. | ||
2559 | 250 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
2560 | 251 | """ | ||
2561 | 252 | |||
2562 | 253 | kwargs.setdefault('allow_redirects', True) | ||
2563 | 254 | return self.request('get', url, **kwargs) | ||
2564 | 255 | |||
2565 | 256 | def options(self, url, **kwargs): | ||
2566 | 257 | """Sends a OPTIONS request. Returns :class:`Response` object. | ||
2567 | 258 | |||
2568 | 259 | :param url: URL for the new :class:`Request` object. | ||
2569 | 260 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
2570 | 261 | """ | ||
2571 | 262 | |||
2572 | 263 | kwargs.setdefault('allow_redirects', True) | ||
2573 | 264 | return self.request('options', url, **kwargs) | ||
2574 | 265 | |||
2575 | 266 | def head(self, url, **kwargs): | ||
2576 | 267 | """Sends a HEAD request. Returns :class:`Response` object. | ||
2577 | 268 | |||
2578 | 269 | :param url: URL for the new :class:`Request` object. | ||
2579 | 270 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
2580 | 271 | """ | ||
2581 | 272 | |||
2582 | 273 | kwargs.setdefault('allow_redirects', False) | ||
2583 | 274 | return self.request('head', url, **kwargs) | ||
2584 | 275 | |||
2585 | 276 | def post(self, url, data=None, **kwargs): | ||
2586 | 277 | """Sends a POST request. Returns :class:`Response` object. | ||
2587 | 278 | |||
2588 | 279 | :param url: URL for the new :class:`Request` object. | ||
2589 | 280 | :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`. | ||
2590 | 281 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
2591 | 282 | """ | ||
2592 | 283 | |||
2593 | 284 | return self.request('post', url, data=data, **kwargs) | ||
2594 | 285 | |||
2595 | 286 | def put(self, url, data=None, **kwargs): | ||
2596 | 287 | """Sends a PUT request. Returns :class:`Response` object. | ||
2597 | 288 | |||
2598 | 289 | :param url: URL for the new :class:`Request` object. | ||
2599 | 290 | :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`. | ||
2600 | 291 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
2601 | 292 | """ | ||
2602 | 293 | |||
2603 | 294 | return self.request('put', url, data=data, **kwargs) | ||
2604 | 295 | |||
2605 | 296 | def patch(self, url, data=None, **kwargs): | ||
2606 | 297 | """Sends a PATCH request. Returns :class:`Response` object. | ||
2607 | 298 | |||
2608 | 299 | :param url: URL for the new :class:`Request` object. | ||
2609 | 300 | :param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`. | ||
2610 | 301 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
2611 | 302 | """ | ||
2612 | 303 | |||
2613 | 304 | return self.request('patch', url, data=data, **kwargs) | ||
2614 | 305 | |||
2615 | 306 | def delete(self, url, **kwargs): | ||
2616 | 307 | """Sends a DELETE request. Returns :class:`Response` object. | ||
2617 | 308 | |||
2618 | 309 | :param url: URL for the new :class:`Request` object. | ||
2619 | 310 | :param \*\*kwargs: Optional arguments that ``request`` takes. | ||
2620 | 311 | """ | ||
2621 | 312 | |||
2622 | 313 | return self.request('delete', url, **kwargs) | ||
2623 | 314 | |||
2624 | 315 | def __getstate__(self): | ||
2625 | 316 | return dict((attr, getattr(self, attr, None)) for attr in self.__attrs__) | ||
2626 | 317 | |||
2627 | 318 | def __setstate__(self, state): | ||
2628 | 319 | for attr, value in state.items(): | ||
2629 | 320 | setattr(self, attr, value) | ||
2630 | 321 | |||
2631 | 322 | self.init_poolmanager() | ||
2632 | 323 | |||
2633 | 324 | |||
2634 | 325 | def session(**kwargs): | ||
2635 | 326 | """Returns a :class:`Session` for context-management.""" | ||
2636 | 327 | |||
2637 | 328 | return Session(**kwargs) | ||
2638 | 0 | 329 | ||
2639 | === added file '.pc/03-use-distro-packages.patch/setup.py' | |||
2640 | --- .pc/03-use-distro-packages.patch/setup.py 1970-01-01 00:00:00 +0000 | |||
2641 | +++ .pc/03-use-distro-packages.patch/setup.py 2013-01-28 21:06:46 +0000 | |||
2642 | @@ -0,0 +1,73 @@ | |||
2643 | 1 | #!/usr/bin/env python | ||
2644 | 2 | |||
2645 | 3 | import os | ||
2646 | 4 | import sys | ||
2647 | 5 | |||
2648 | 6 | import requests | ||
2649 | 7 | from requests.compat import is_py2 | ||
2650 | 8 | |||
2651 | 9 | try: | ||
2652 | 10 | from setuptools import setup | ||
2653 | 11 | except ImportError: | ||
2654 | 12 | from distutils.core import setup | ||
2655 | 13 | |||
2656 | 14 | if sys.argv[-1] == 'publish': | ||
2657 | 15 | os.system('python setup.py sdist upload') | ||
2658 | 16 | sys.exit() | ||
2659 | 17 | |||
2660 | 18 | os.environ['PYTHONDONTWRITEBYTECODE'] = '1' | ||
2661 | 19 | |||
2662 | 20 | packages = [ | ||
2663 | 21 | 'requests', | ||
2664 | 22 | 'requests.packages', | ||
2665 | 23 | 'requests.packages.urllib3', | ||
2666 | 24 | 'requests.packages.urllib3.packages', | ||
2667 | 25 | 'requests.packages.urllib3.packages.ssl_match_hostname' | ||
2668 | 26 | ] | ||
2669 | 27 | |||
2670 | 28 | if is_py2: | ||
2671 | 29 | packages.extend([ | ||
2672 | 30 | 'requests.packages.oauthlib', | ||
2673 | 31 | 'requests.packages.oauthlib.oauth1', | ||
2674 | 32 | 'requests.packages.oauthlib.oauth1.rfc5849', | ||
2675 | 33 | 'requests.packages.oauthlib.oauth2', | ||
2676 | 34 | 'requests.packages.oauthlib.oauth2.draft25', | ||
2677 | 35 | 'requests.packages.chardet', | ||
2678 | 36 | ]) | ||
2679 | 37 | else: | ||
2680 | 38 | packages.append('requests.packages.chardet2') | ||
2681 | 39 | |||
2682 | 40 | requires = [] | ||
2683 | 41 | |||
2684 | 42 | setup( | ||
2685 | 43 | name='requests', | ||
2686 | 44 | version=requests.__version__, | ||
2687 | 45 | description='Python HTTP for Humans.', | ||
2688 | 46 | long_description=open('README.rst').read() + '\n\n' + | ||
2689 | 47 | open('HISTORY.rst').read(), | ||
2690 | 48 | author='Kenneth Reitz', | ||
2691 | 49 | author_email='me@kennethreitz.com', | ||
2692 | 50 | url='http://python-requests.org', | ||
2693 | 51 | packages=packages, | ||
2694 | 52 | package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']}, | ||
2695 | 53 | package_dir={'requests': 'requests'}, | ||
2696 | 54 | include_package_data=True, | ||
2697 | 55 | install_requires=requires, | ||
2698 | 56 | license=open('LICENSE').read(), | ||
2699 | 57 | classifiers=( | ||
2700 | 58 | 'Development Status :: 5 - Production/Stable', | ||
2701 | 59 | 'Intended Audience :: Developers', | ||
2702 | 60 | 'Natural Language :: English', | ||
2703 | 61 | 'License :: OSI Approved :: ISC License (ISCL)', | ||
2704 | 62 | 'Programming Language :: Python', | ||
2705 | 63 | 'Programming Language :: Python :: 2.6', | ||
2706 | 64 | 'Programming Language :: Python :: 2.7', | ||
2707 | 65 | 'Programming Language :: Python :: 3', | ||
2708 | 66 | 'Programming Language :: Python :: 3.0', | ||
2709 | 67 | 'Programming Language :: Python :: 3.1', | ||
2710 | 68 | 'Programming Language :: Python :: 3.2', | ||
2711 | 69 | 'Programming Language :: Python :: 3.3', | ||
2712 | 70 | ), | ||
2713 | 71 | ) | ||
2714 | 72 | |||
2715 | 73 | del os.environ['PYTHONDONTWRITEBYTECODE'] | ||
2716 | 0 | 74 | ||
2717 | === added file '.pc/applied-patches' | |||
2718 | --- .pc/applied-patches 1970-01-01 00:00:00 +0000 | |||
2719 | +++ .pc/applied-patches 2013-01-28 21:06:46 +0000 | |||
2720 | @@ -0,0 +1,2 @@ | |||
2721 | 1 | 02_do-not-use-embedded-python-six.patch | ||
2722 | 2 | 03-use-distro-packages.patch | ||
2723 | 0 | 3 | ||
2724 | === modified file 'HISTORY.rst' | |||
2725 | --- HISTORY.rst 2011-11-25 00:02:28 +0000 | |||
2726 | +++ HISTORY.rst 2013-01-28 21:06:46 +0000 | |||
2727 | @@ -1,10 +1,306 @@ | |||
2728 | 1 | .. :changelog: | ||
2729 | 2 | |||
2730 | 1 | History | 3 | History |
2731 | 2 | ------- | 4 | ------- |
2732 | 3 | 5 | ||
2733 | 6 | 0.14.2 (2012-10-27) | ||
2734 | 7 | +++++++++++++++++++ | ||
2735 | 8 | |||
2736 | 9 | - Improved mime-compatible JSON handling | ||
2737 | 10 | - Proxy fixes | ||
2738 | 11 | - Path hack fixes | ||
2739 | 12 | - Case-Insensistive Content-Encoding headers | ||
2740 | 13 | - Support for CJK parameters in form posts | ||
2741 | 14 | |||
2742 | 15 | |||
2743 | 16 | 0.14.1 (2012-10-01) | ||
2744 | 17 | +++++++++++++++++++ | ||
2745 | 18 | |||
2746 | 19 | - Python 3.3 Compatibility | ||
2747 | 20 | - Simply default accept-encoding | ||
2748 | 21 | - Bugfixes | ||
2749 | 22 | |||
2750 | 23 | |||
2751 | 24 | 0.14.0 (2012-09-02) | ||
2752 | 25 | ++++++++++++++++++++ | ||
2753 | 26 | |||
2754 | 27 | - No more iter_content errors if already downloaded. | ||
2755 | 28 | |||
2756 | 29 | 0.13.9 (2012-08-25) | ||
2757 | 30 | +++++++++++++++++++ | ||
2758 | 31 | |||
2759 | 32 | - Fix for OAuth + POSTs | ||
2760 | 33 | - Remove exception eating from dispatch_hook | ||
2761 | 34 | - General bugfixes | ||
2762 | 35 | |||
2763 | 36 | 0.13.8 (2012-08-21) | ||
2764 | 37 | +++++++++++++++++++ | ||
2765 | 38 | |||
2766 | 39 | - Incredible Link header support :) | ||
2767 | 40 | |||
2768 | 41 | 0.13.7 (2012-08-19) | ||
2769 | 42 | +++++++++++++++++++ | ||
2770 | 43 | |||
2771 | 44 | - Support for (key, value) lists everywhere. | ||
2772 | 45 | - Digest Authentication improvements. | ||
2773 | 46 | - Ensure proxy exclusions work properly. | ||
2774 | 47 | - Clearer UnicodeError exceptions. | ||
2775 | 48 | - Automatic casting of URLs to tsrings (fURL and such) | ||
2776 | 49 | - Bugfixes. | ||
2777 | 50 | |||
2778 | 51 | 0.13.6 (2012-08-06) | ||
2779 | 52 | +++++++++++++++++++ | ||
2780 | 53 | |||
2781 | 54 | - Long awaited fix for hanging connections! | ||
2782 | 55 | |||
2783 | 56 | 0.13.5 (2012-07-27) | ||
2784 | 57 | +++++++++++++++++++ | ||
2785 | 58 | |||
2786 | 59 | - Packaging fix | ||
2787 | 60 | |||
2788 | 61 | 0.13.4 (2012-07-27) | ||
2789 | 62 | +++++++++++++++++++ | ||
2790 | 63 | |||
2791 | 64 | - GSSAPI/Kerberos authentication! | ||
2792 | 65 | - App Engine 2.7 Fixes! | ||
2793 | 66 | - Fix leaking connections (from urllib3 update) | ||
2794 | 67 | - OAuthlib path hack fix | ||
2795 | 68 | - OAuthlib URL parameters fix. | ||
2796 | 69 | |||
2797 | 70 | 0.13.3 (2012-07-12) | ||
2798 | 71 | +++++++++++++++++++ | ||
2799 | 72 | |||
2800 | 73 | - Use simplejson if available. | ||
2801 | 74 | - Do not hide SSLErrors behind Timeouts. | ||
2802 | 75 | - Fixed param handling with urls containing fragments. | ||
2803 | 76 | - Significantly improved information in User Agent. | ||
2804 | 77 | - client certificates are ignored when verify=False | ||
2805 | 78 | |||
2806 | 79 | 0.13.2 (2012-06-28) | ||
2807 | 80 | +++++++++++++++++++ | ||
2808 | 81 | |||
2809 | 82 | - Zero dependencies (once again)! | ||
2810 | 83 | - New: Response.reason | ||
2811 | 84 | - Sign querystring parameters in OAuth 1.0 | ||
2812 | 85 | - Client certificates no longer ignored when verify=False | ||
2813 | 86 | - Add openSUSE certificate support | ||
2814 | 87 | |||
2815 | 88 | 0.13.1 (2012-06-07) | ||
2816 | 89 | +++++++++++++++++++ | ||
2817 | 90 | |||
2818 | 91 | - Allow passing a file or file-like object as data. | ||
2819 | 92 | - Allow hooks to return responses that indicate errors. | ||
2820 | 93 | - Fix Response.text and Response.json for body-less responses. | ||
2821 | 94 | |||
2822 | 95 | 0.13.0 (2012-05-29) | ||
2823 | 96 | +++++++++++++++++++ | ||
2824 | 97 | |||
2825 | 98 | - Removal of Requests.async in favor of `grequests <https://github.com/kennethreitz/grequests>`_ | ||
2826 | 99 | - Allow disabling of cookie persistiance. | ||
2827 | 100 | - New implimentation of safe_mode | ||
2828 | 101 | - cookies.get now supports default argument | ||
2829 | 102 | - Session cookies not saved when Session.request is called with return_response=False | ||
2830 | 103 | - Env: no_proxy support. | ||
2831 | 104 | - RequestsCookieJar improvements. | ||
2832 | 105 | - Various bug fixes. | ||
2833 | 106 | |||
2834 | 107 | 0.12.1 (2012-05-08) | ||
2835 | 108 | +++++++++++++++++++ | ||
2836 | 109 | |||
2837 | 110 | - New ``Response.json`` property. | ||
2838 | 111 | - Ability to add string file uploads. | ||
2839 | 112 | - Fix out-of-range issue with iter_lines. | ||
2840 | 113 | - Fix iter_content default size. | ||
2841 | 114 | - Fix POST redirects containing files. | ||
2842 | 115 | |||
2843 | 116 | 0.12.0 (2012-05-02) | ||
2844 | 117 | +++++++++++++++++++ | ||
2845 | 118 | |||
2846 | 119 | - EXPERIMENTAL OAUTH SUPPORT! | ||
2847 | 120 | - Proper CookieJar-backed cookies interface with awesome dict-like interface. | ||
2848 | 121 | - Speed fix for non-iterated content chunks. | ||
2849 | 122 | - Move ``pre_request`` to a more usable place. | ||
2850 | 123 | - New ``pre_send`` hook. | ||
2851 | 124 | - Lazily encode data, params, files. | ||
2852 | 125 | - Load system Certificate Bundle if ``certify`` isn't available. | ||
2853 | 126 | - Cleanups, fixes. | ||
2854 | 127 | |||
2855 | 128 | 0.11.2 (2012-04-22) | ||
2856 | 129 | +++++++++++++++++++ | ||
2857 | 130 | |||
2858 | 131 | - Attempt to use the OS's certificate bundle if ``certifi`` isn't available. | ||
2859 | 132 | - Infinite digest auth redirect fix. | ||
2860 | 133 | - Multi-part file upload improvements. | ||
2861 | 134 | - Fix decoding of invalid %encodings in URLs. | ||
2862 | 135 | - If there is no content in a response don't throw an error the second time that content is attempted to be read. | ||
2863 | 136 | - Upload data on redirects. | ||
2864 | 137 | |||
2865 | 138 | 0.11.1 (2012-03-30) | ||
2866 | 139 | +++++++++++++++++++ | ||
2867 | 140 | |||
2868 | 141 | * POST redirects now break RFC to do what browsers do: Follow up with a GET. | ||
2869 | 142 | * New ``strict_mode`` configuration to disable new redirect behavior. | ||
2870 | 143 | |||
2871 | 144 | |||
2872 | 145 | 0.11.0 (2012-03-14) | ||
2873 | 146 | +++++++++++++++++++ | ||
2874 | 147 | |||
2875 | 148 | * Private SSL Certificate support | ||
2876 | 149 | * Remove select.poll from Gevent monkeypatching | ||
2877 | 150 | * Remove redundant generator for chunked transfer encoding | ||
2878 | 151 | * Fix: Response.ok raises Timeout Exception in safe_mode | ||
2879 | 152 | |||
2880 | 153 | 0.10.8 (2012-03-09) | ||
2881 | 154 | +++++++++++++++++++ | ||
2882 | 155 | |||
2883 | 156 | * Generate chunked ValueError fix | ||
2884 | 157 | * Proxy configuration by environment variables | ||
2885 | 158 | * Simplification of iter_lines. | ||
2886 | 159 | * New `trust_env` configuration for disabling system/environment hints. | ||
2887 | 160 | * Suppress cookie errors. | ||
2888 | 161 | |||
2889 | 162 | 0.10.7 (2012-03-07) | ||
2890 | 163 | +++++++++++++++++++ | ||
2891 | 164 | |||
2892 | 165 | * `encode_uri` = False | ||
2893 | 166 | |||
2894 | 167 | 0.10.6 (2012-02-25) | ||
2895 | 168 | +++++++++++++++++++ | ||
2896 | 169 | |||
2897 | 170 | * Allow '=' in cookies. | ||
2898 | 171 | |||
2899 | 172 | 0.10.5 (2012-02-25) | ||
2900 | 173 | +++++++++++++++++++ | ||
2901 | 174 | |||
2902 | 175 | * Response body with 0 content-length fix. | ||
2903 | 176 | * New async.imap. | ||
2904 | 177 | * Don't fail on netrc. | ||
2905 | 178 | |||
2906 | 179 | |||
2907 | 180 | 0.10.4 (2012-02-20) | ||
2908 | 181 | +++++++++++++++++++ | ||
2909 | 182 | |||
2910 | 183 | * Honor netrc. | ||
2911 | 184 | |||
2912 | 185 | 0.10.3 (2012-02-20) | ||
2913 | 186 | +++++++++++++++++++ | ||
2914 | 187 | |||
2915 | 188 | * HEAD requests don't follow redirects anymore. | ||
2916 | 189 | * raise_for_status() doesn't raise for 3xx anymore. | ||
2917 | 190 | * Make Session objects picklable. | ||
2918 | 191 | * ValueError for invalid schema URLs. | ||
2919 | 192 | |||
2920 | 193 | 0.10.2 (2012-01-15) | ||
2921 | 194 | +++++++++++++++++++ | ||
2922 | 195 | |||
2923 | 196 | * Vastly improved URL quoting. | ||
2924 | 197 | * Additional allowed cookie key values. | ||
2925 | 198 | * Attempted fix for "Too many open files" Error | ||
2926 | 199 | * Replace unicode errors on first pass, no need for second pass. | ||
2927 | 200 | * Append '/' to bare-domain urls before query insertion. | ||
2928 | 201 | * Exceptions now inherit from RuntimeError. | ||
2929 | 202 | * Binary uploads + auth fix. | ||
2930 | 203 | * Bugfixes. | ||
2931 | 204 | |||
2932 | 205 | |||
2933 | 206 | 0.10.1 (2012-01-23) | ||
2934 | 207 | +++++++++++++++++++ | ||
2935 | 208 | |||
2936 | 209 | * PYTHON 3 SUPPORT! | ||
2937 | 210 | * Dropped 2.5 Support. (*Backwards Incompatible*) | ||
2938 | 211 | |||
2939 | 212 | 0.10.0 (2012-01-21) | ||
2940 | 213 | +++++++++++++++++++ | ||
2941 | 214 | |||
2942 | 215 | * ``Response.content`` is now bytes-only. (*Backwards Incompatible*) | ||
2943 | 216 | * New ``Response.text`` is unicode-only. | ||
2944 | 217 | * If no ``Response.encoding`` is specified and ``chardet`` is available, ``Respoonse.text`` will guess an encoding. | ||
2945 | 218 | * Default to ISO-8859-1 (Western) encoding for "text" subtypes. | ||
2946 | 219 | * Removal of `decode_unicode`. (*Backwards Incompatible*) | ||
2947 | 220 | * New multiple-hooks system. | ||
2948 | 221 | * New ``Response.register_hook`` for registering hooks within the pipeline. | ||
2949 | 222 | * ``Response.url`` is now Unicode. | ||
2950 | 223 | |||
2951 | 224 | 0.9.3 (2012-01-18) | ||
2952 | 225 | ++++++++++++++++++ | ||
2953 | 226 | |||
2954 | 227 | * SSL verify=False bugfix (apparent on windows machines). | ||
2955 | 228 | |||
2956 | 229 | 0.9.2 (2012-01-18) | ||
2957 | 230 | ++++++++++++++++++ | ||
2958 | 231 | |||
2959 | 232 | * Asynchronous async.send method. | ||
2960 | 233 | * Support for proper chunk streams with boundaries. | ||
2961 | 234 | * session argument for Session classes. | ||
2962 | 235 | * Print entire hook tracebacks, not just exception instance. | ||
2963 | 236 | * Fix response.iter_lines from pending next line. | ||
2964 | 237 | * Fix but in HTTP-digest auth w/ URI having query strings. | ||
2965 | 238 | * Fix in Event Hooks section. | ||
2966 | 239 | * Urllib3 update. | ||
2967 | 240 | |||
2968 | 241 | |||
2969 | 242 | 0.9.1 (2012-01-06) | ||
2970 | 243 | ++++++++++++++++++ | ||
2971 | 244 | |||
2972 | 245 | * danger_mode for automatic Response.raise_for_status() | ||
2973 | 246 | * Response.iter_lines refactor | ||
2974 | 247 | |||
2975 | 248 | 0.9.0 (2011-12-28) | ||
2976 | 249 | ++++++++++++++++++ | ||
2977 | 250 | |||
2978 | 251 | * verify ssl is default. | ||
2979 | 252 | |||
2980 | 253 | |||
2981 | 254 | 0.8.9 (2011-12-28) | ||
2982 | 255 | ++++++++++++++++++ | ||
2983 | 256 | |||
2984 | 257 | * Packaging fix. | ||
2985 | 258 | |||
2986 | 259 | |||
2987 | 260 | 0.8.8 (2011-12-28) | ||
2988 | 261 | ++++++++++++++++++ | ||
2989 | 262 | |||
2990 | 263 | * SSL CERT VERIFICATION! | ||
2991 | 264 | * Release of Cerifi: Mozilla's cert list. | ||
2992 | 265 | * New 'verify' argument for SSL requests. | ||
2993 | 266 | * Urllib3 update. | ||
2994 | 267 | |||
2995 | 268 | 0.8.7 (2011-12-24) | ||
2996 | 269 | ++++++++++++++++++ | ||
2997 | 270 | |||
2998 | 271 | * iter_lines last-line truncation fix | ||
2999 | 272 | * Force safe_mode for async requests | ||
3000 | 273 | * Handle safe_mode exceptions more consistently | ||
3001 | 274 | * Fix iteration on null responses in safe_mode | ||
3002 | 275 | |||
3003 | 276 | 0.8.6 (2011-12-18) | ||
3004 | 277 | ++++++++++++++++++ | ||
3005 | 278 | |||
3006 | 279 | * Socket timeout fixes. | ||
3007 | 280 | * Proxy Authorization support. | ||
3008 | 281 | |||
3009 | 282 | 0.8.5 (2011-12-14) | ||
3010 | 283 | ++++++++++++++++++ | ||
3011 | 284 | |||
3012 | 285 | * Response.iter_lines! | ||
3013 | 286 | |||
3014 | 287 | 0.8.4 (2011-12-11) | ||
3015 | 288 | ++++++++++++++++++ | ||
3016 | 289 | |||
3017 | 290 | * Prefetch bugfix. | ||
3018 | 291 | * Added license to installed version. | ||
3019 | 292 | |||
3020 | 293 | 0.8.3 (2011-11-27) | ||
3021 | 294 | ++++++++++++++++++ | ||
3022 | 295 | |||
3023 | 296 | * Converted auth system to use simpler callable objects. | ||
3024 | 297 | * New session parameter to API methods. | ||
3025 | 298 | * Display full URL while logging. | ||
3026 | 299 | |||
3027 | 4 | 0.8.2 (2011-11-19) | 300 | 0.8.2 (2011-11-19) |
3028 | 5 | ++++++++++++++++++ | 301 | ++++++++++++++++++ |
3029 | 6 | 302 | ||
3031 | 7 | * New unicode decoding system, based on overridable `Response.encoding`. | 303 | * New Unicode decoding system, based on over-ridable `Response.encoding`. |
3032 | 8 | * Proper URL slash-quote handling. | 304 | * Proper URL slash-quote handling. |
3033 | 9 | * Cookies with ``[``, ``]``, and ``_`` allowed. | 305 | * Cookies with ``[``, ``]``, and ``_`` allowed. |
3034 | 10 | 306 | ||
3035 | @@ -28,6 +324,7 @@ | |||
3036 | 28 | * OPTION method | 324 | * OPTION method |
3037 | 29 | * Async pool size throttling | 325 | * Async pool size throttling |
3038 | 30 | * File uploads send real names | 326 | * File uploads send real names |
3039 | 327 | * Vendored in urllib3 | ||
3040 | 31 | 328 | ||
3041 | 32 | 0.7.6 (2011-11-07) | 329 | 0.7.6 (2011-11-07) |
3042 | 33 | ++++++++++++++++++ | 330 | ++++++++++++++++++ |
3043 | @@ -43,7 +340,7 @@ | |||
3044 | 43 | 0.7.4 (2011-10-26) | 340 | 0.7.4 (2011-10-26) |
3045 | 44 | ++++++++++++++++++ | 341 | ++++++++++++++++++ |
3046 | 45 | 342 | ||
3048 | 46 | * Sesion Hooks fix. | 343 | * Session Hooks fix. |
3049 | 47 | 344 | ||
3050 | 48 | 0.7.3 (2011-10-23) | 345 | 0.7.3 (2011-10-23) |
3051 | 49 | ++++++++++++++++++ | 346 | ++++++++++++++++++ |
3052 | 50 | 347 | ||
3053 | === modified file 'LICENSE' | |||
3054 | --- LICENSE 2011-06-06 02:11:15 +0000 | |||
3055 | +++ LICENSE 2013-01-28 21:06:46 +0000 | |||
3056 | @@ -1,4 +1,4 @@ | |||
3058 | 1 | Copyright (c) 2011 Kenneth Reitz. | 1 | Copyright (c) 2012 Kenneth Reitz. |
3059 | 2 | 2 | ||
3060 | 3 | Permission to use, copy, modify, and/or distribute this software for any | 3 | Permission to use, copy, modify, and/or distribute this software for any |
3061 | 4 | purpose with or without fee is hereby granted, provided that the above | 4 | purpose with or without fee is hereby granted, provided that the above |
3062 | 5 | 5 | ||
3063 | === modified file 'MANIFEST.in' | |||
3064 | --- MANIFEST.in 2011-10-19 20:49:39 +0000 | |||
3065 | +++ MANIFEST.in 2013-01-28 21:06:46 +0000 | |||
3066 | @@ -1,1 +1,1 @@ | |||
3068 | 1 | include README.rst LICENSE HISTORY.rst test_requests.py | 1 | include README.rst LICENSE NOTICE HISTORY.rst tests/*. requests/cacert.pem |
3069 | 2 | 2 | ||
3070 | === added file 'NOTICE' | |||
3071 | --- NOTICE 1970-01-01 00:00:00 +0000 | |||
3072 | +++ NOTICE 2013-01-28 21:06:46 +0000 | |||
3073 | @@ -0,0 +1,116 @@ | |||
3074 | 1 | Requests includes some vendorized python libraries to ease installation. | ||
3075 | 2 | |||
3076 | 3 | Urllib3 License | ||
3077 | 4 | =============== | ||
3078 | 5 | |||
3079 | 6 | This is the MIT license: http://www.opensource.org/licenses/mit-license.php | ||
3080 | 7 | |||
3081 | 8 | Copyright 2008-2011 Andrey Petrov and contributors (see CONTRIBUTORS.txt), | ||
3082 | 9 | Modifications copyright 2022 Kenneth Reitz. | ||
3083 | 10 | |||
3084 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
3085 | 12 | software and associated documentation files (the "Software"), to deal in the Software | ||
3086 | 13 | without restriction, including without limitation the rights to use, copy, modify, merge, | ||
3087 | 14 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | ||
3088 | 15 | to whom the Software is furnished to do so, subject to the following conditions: | ||
3089 | 16 | |||
3090 | 17 | The above copyright notice and this permission notice shall be included in all copies or | ||
3091 | 18 | substantial portions of the Software. | ||
3092 | 19 | |||
3093 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
3094 | 21 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
3095 | 22 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE | ||
3096 | 23 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
3097 | 24 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
3098 | 25 | DEALINGS IN THE SOFTWARE. | ||
3099 | 26 | |||
3100 | 27 | |||
3101 | 28 | Chardet License | ||
3102 | 29 | =============== | ||
3103 | 30 | |||
3104 | 31 | This library is free software; you can redistribute it and/or | ||
3105 | 32 | modify it under the terms of the GNU Lesser General Public | ||
3106 | 33 | License as published by the Free Software Foundation; either | ||
3107 | 34 | version 2.1 of the License, or (at your option) any later version. | ||
3108 | 35 | |||
3109 | 36 | This library is distributed in the hope that it will be useful, | ||
3110 | 37 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3111 | 38 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
3112 | 39 | Lesser General Public License for more details. | ||
3113 | 40 | |||
3114 | 41 | You should have received a copy of the GNU Lesser General Public | ||
3115 | 42 | License along with this library; if not, write to the Free Software | ||
3116 | 43 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
3117 | 44 | 02110-1301 USA | ||
3118 | 45 | |||
3119 | 46 | |||
3120 | 47 | |||
3121 | 48 | Chardet2 License | ||
3122 | 49 | ================ | ||
3123 | 50 | |||
3124 | 51 | This library is free software; you can redistribute it and/or | ||
3125 | 52 | modify it under the terms of the GNU Lesser General Public | ||
3126 | 53 | License as published by the Free Software Foundation; either | ||
3127 | 54 | version 2.1 of the License, or (at your option) any later version. | ||
3128 | 55 | |||
3129 | 56 | This library is distributed in the hope that it will be useful, | ||
3130 | 57 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3131 | 58 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
3132 | 59 | Lesser General Public License for more details. | ||
3133 | 60 | |||
3134 | 61 | You should have received a copy of the GNU Lesser General Public | ||
3135 | 62 | License along with this library; if not, write to the Free Software | ||
3136 | 63 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
3137 | 64 | 02110-1301 USA | ||
3138 | 65 | |||
3139 | 66 | |||
3140 | 67 | |||
3141 | 68 | Bundle of CA Root Certificates | ||
3142 | 69 | ============================== | ||
3143 | 70 | |||
3144 | 71 | This library is free software; you can redistribute it and/or | ||
3145 | 72 | modify it under the terms of the GNU Lesser General Public | ||
3146 | 73 | License as published by the Free Software Foundation; either | ||
3147 | 74 | version 2.1 of the License, or (at your option) any later version. | ||
3148 | 75 | |||
3149 | 76 | This library is distributed in the hope that it will be useful, | ||
3150 | 77 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3151 | 78 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
3152 | 79 | Lesser General Public License for more details. | ||
3153 | 80 | |||
3154 | 81 | You should have received a copy of the GNU Lesser General Public | ||
3155 | 82 | License along with this library; if not, write to the Free Software | ||
3156 | 83 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
3157 | 84 | 02110-1301 | ||
3158 | 85 | |||
3159 | 86 | |||
3160 | 87 | OAuthlib | ||
3161 | 88 | ======== | ||
3162 | 89 | |||
3163 | 90 | Copyright (c) 2011 Idan Gazit and contributors | ||
3164 | 91 | All rights reserved. | ||
3165 | 92 | |||
3166 | 93 | Redistribution and use in source and binary forms, with or without | ||
3167 | 94 | modification, are permitted provided that the following conditions are met: | ||
3168 | 95 | |||
3169 | 96 | 1. Redistributions of source code must retain the above copyright notice, | ||
3170 | 97 | this list of conditions and the following disclaimer. | ||
3171 | 98 | |||
3172 | 99 | 2. Redistributions in binary form must reproduce the above copyright | ||
3173 | 100 | notice, this list of conditions and the following disclaimer in the | ||
3174 | 101 | documentation and/or other materials provided with the distribution. | ||
3175 | 102 | |||
3176 | 103 | 3. Neither the name of this project nor the names of its contributors may | ||
3177 | 104 | be used to endorse or promote products derived from this software without | ||
3178 | 105 | specific prior written permission. | ||
3179 | 106 | |||
3180 | 107 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
3181 | 108 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
3182 | 109 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
3183 | 110 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
3184 | 111 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
3185 | 112 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
3186 | 113 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
3187 | 114 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
3188 | 115 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
3189 | 116 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
3190 | 0 | 117 | ||
3191 | === modified file 'PKG-INFO' | |||
3192 | --- PKG-INFO 2011-11-25 00:02:28 +0000 | |||
3193 | +++ PKG-INFO 2013-01-28 21:06:46 +0000 | |||
3194 | @@ -1,14 +1,30 @@ | |||
3196 | 1 | Metadata-Version: 1.0 | 1 | Metadata-Version: 1.1 |
3197 | 2 | Name: requests | 2 | Name: requests |
3199 | 3 | Version: 0.8.2 | 3 | Version: 0.14.2 |
3200 | 4 | Summary: Python HTTP for Humans. | 4 | Summary: Python HTTP for Humans. |
3201 | 5 | Home-page: http://python-requests.org | 5 | Home-page: http://python-requests.org |
3202 | 6 | Author: Kenneth Reitz | 6 | Author: Kenneth Reitz |
3203 | 7 | Author-email: me@kennethreitz.com | 7 | Author-email: me@kennethreitz.com |
3205 | 8 | License: ISC | 8 | License: Copyright (c) 2012 Kenneth Reitz. |
3206 | 9 | |||
3207 | 10 | Permission to use, copy, modify, and/or distribute this software for any | ||
3208 | 11 | purpose with or without fee is hereby granted, provided that the above | ||
3209 | 12 | copyright notice and this permission notice appear in all copies. | ||
3210 | 13 | |||
3211 | 14 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
3212 | 15 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
3213 | 16 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
3214 | 17 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
3215 | 18 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
3216 | 19 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
3217 | 20 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
3218 | 9 | Description: Requests: HTTP for Humans | 21 | Description: Requests: HTTP for Humans |
3219 | 10 | ========================= | 22 | ========================= |
3220 | 11 | 23 | ||
3221 | 24 | |||
3222 | 25 | .. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop | ||
3223 | 26 | :target: https://secure.travis-ci.org/kennethreitz/requests | ||
3224 | 27 | |||
3225 | 12 | Requests is an ISC Licensed HTTP library, written in Python, for human | 28 | Requests is an ISC Licensed HTTP library, written in Python, for human |
3226 | 13 | beings. | 29 | beings. |
3227 | 14 | 30 | ||
3228 | @@ -27,60 +43,32 @@ | |||
3229 | 27 | 204 | 43 | 204 |
3230 | 28 | >>> r.headers['content-type'] | 44 | >>> r.headers['content-type'] |
3231 | 29 | 'application/json' | 45 | 'application/json' |
3233 | 30 | >>> r.content | 46 | >>> r.text |
3234 | 31 | ... | 47 | ... |
3235 | 32 | 48 | ||
3236 | 33 | See `the same code, without Requests <https://gist.github.com/973705>`_. | 49 | See `the same code, without Requests <https://gist.github.com/973705>`_. |
3237 | 34 | 50 | ||
3240 | 35 | Requests allow you to send **HEAD**, **GET**, **POST**, **PUT**, | 51 | Requests allow you to send HTTP/1.1 requests. You can add headers, form data, |
3239 | 36 | **PATCH**, and **DELETE** HTTP requests. You can add headers, form data, | ||
3241 | 37 | multipart files, and parameters with simple Python dictionaries, and access the | 52 | multipart files, and parameters with simple Python dictionaries, and access the |
3244 | 38 | response data in the same way. It's powered by httplib, but it does | 53 | response data in the same way. It's powered by httplib and `urllib3 |
3245 | 39 | all the hard work and crazy hacks for you. | 54 | <https://github.com/shazow/urllib3>`_, but it does all the hard work and crazy |
3246 | 55 | hacks for you. | ||
3247 | 40 | 56 | ||
3248 | 41 | 57 | ||
3249 | 42 | Features | 58 | Features |
3250 | 43 | -------- | 59 | -------- |
3251 | 44 | 60 | ||
3291 | 45 | - Extremely simple HEAD, GET, POST, PUT, PATCH, DELETE Requests. | 61 | - International Domains and URLs |
3292 | 46 | - Gevent support for Asyncronous Requests. | 62 | - Keep-Alive & Connection Pooling |
3293 | 47 | - Sessions with cookie persistience. | 63 | - Sessions with Cookie Persistence |
3294 | 48 | - Basic, Digest, and Custom Authentication support. | 64 | - Browser-style SSL Verification |
3295 | 49 | - Automatic form-encoding of dictionaries | 65 | - Basic/Digest Authentication |
3296 | 50 | - A simple dictionary interface for request/response cookies. | 66 | - Elegant Key/Value Cookies |
3297 | 51 | - Multipart file uploads. | 67 | - Automatic Decompression |
3298 | 52 | - Automatc decoding of Unicode, gzip, and deflate responses. | 68 | - Unicode Response Bodies |
3299 | 53 | - Full support for unicode URLs and domain names. | 69 | - Multipart File Uploads |
3300 | 54 | 70 | - Connection Timeouts | |
3301 | 55 | 71 | - Thread-safety | |
3263 | 56 | Usage | ||
3264 | 57 | ----- | ||
3265 | 58 | |||
3266 | 59 | It couldn't be simpler. :: | ||
3267 | 60 | |||
3268 | 61 | >>> import requests | ||
3269 | 62 | >>> r = requests.get('http://google.com') | ||
3270 | 63 | |||
3271 | 64 | |||
3272 | 65 | HTTPS? Basic Authentication? :: | ||
3273 | 66 | |||
3274 | 67 | >>> r = requests.get('https://httpbin.ep.io/basic-auth/user/pass') | ||
3275 | 68 | >>> r.status_code | ||
3276 | 69 | 401 | ||
3277 | 70 | |||
3278 | 71 | |||
3279 | 72 | Uh oh, we're not authorized! Let's add authentication. :: | ||
3280 | 73 | |||
3281 | 74 | >>> r = requests.get('https://httpbin.ep.io/basic-auth/user/pass', auth=('user', 'pass')) | ||
3282 | 75 | |||
3283 | 76 | >>> r.status_code | ||
3284 | 77 | 200 | ||
3285 | 78 | |||
3286 | 79 | >>> r.headers['content-type'] | ||
3287 | 80 | 'application/json' | ||
3288 | 81 | |||
3289 | 82 | >>> r.content | ||
3290 | 83 | '{"authenticated": true, "user": "user"}' | ||
3302 | 84 | 72 | ||
3303 | 85 | 73 | ||
3304 | 86 | Installation | 74 | Installation |
3305 | @@ -107,16 +95,312 @@ | |||
3306 | 107 | #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. | 95 | #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. |
3307 | 108 | 96 | ||
3308 | 109 | .. _`the repository`: http://github.com/kennethreitz/requests | 97 | .. _`the repository`: http://github.com/kennethreitz/requests |
3311 | 110 | .. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORS | 98 | .. _AUTHORS: https://github.com/kennethreitz/requests/blob/develop/AUTHORS.rst |
3312 | 111 | 99 | ||
3313 | 100 | |||
3314 | 101 | .. :changelog: | ||
3315 | 112 | 102 | ||
3316 | 113 | History | 103 | History |
3317 | 114 | ------- | 104 | ------- |
3318 | 115 | 105 | ||
3319 | 106 | 0.14.2 (2012-10-27) | ||
3320 | 107 | +++++++++++++++++++ | ||
3321 | 108 | |||
3322 | 109 | - Improved mime-compatible JSON handling | ||
3323 | 110 | - Proxy fixes | ||
3324 | 111 | - Path hack fixes | ||
3325 | 112 | - Case-Insensistive Content-Encoding headers | ||
3326 | 113 | - Support for CJK parameters in form posts | ||
3327 | 114 | |||
3328 | 115 | |||
3329 | 116 | 0.14.1 (2012-10-01) | ||
3330 | 117 | +++++++++++++++++++ | ||
3331 | 118 | |||
3332 | 119 | - Python 3.3 Compatibility | ||
3333 | 120 | - Simply default accept-encoding | ||
3334 | 121 | - Bugfixes | ||
3335 | 122 | |||
3336 | 123 | |||
3337 | 124 | 0.14.0 (2012-09-02) | ||
3338 | 125 | ++++++++++++++++++++ | ||
3339 | 126 | |||
3340 | 127 | - No more iter_content errors if already downloaded. | ||
3341 | 128 | |||
3342 | 129 | 0.13.9 (2012-08-25) | ||
3343 | 130 | +++++++++++++++++++ | ||
3344 | 131 | |||
3345 | 132 | - Fix for OAuth + POSTs | ||
3346 | 133 | - Remove exception eating from dispatch_hook | ||
3347 | 134 | - General bugfixes | ||
3348 | 135 | |||
3349 | 136 | 0.13.8 (2012-08-21) | ||
3350 | 137 | +++++++++++++++++++ | ||
3351 | 138 | |||
3352 | 139 | - Incredible Link header support :) | ||
3353 | 140 | |||
3354 | 141 | 0.13.7 (2012-08-19) | ||
3355 | 142 | +++++++++++++++++++ | ||
3356 | 143 | |||
3357 | 144 | - Support for (key, value) lists everywhere. | ||
3358 | 145 | - Digest Authentication improvements. | ||
3359 | 146 | - Ensure proxy exclusions work properly. | ||
3360 | 147 | - Clearer UnicodeError exceptions. | ||
3361 | 148 | - Automatic casting of URLs to tsrings (fURL and such) | ||
3362 | 149 | - Bugfixes. | ||
3363 | 150 | |||
3364 | 151 | 0.13.6 (2012-08-06) | ||
3365 | 152 | +++++++++++++++++++ | ||
3366 | 153 | |||
3367 | 154 | - Long awaited fix for hanging connections! | ||
3368 | 155 | |||
3369 | 156 | 0.13.5 (2012-07-27) | ||
3370 | 157 | +++++++++++++++++++ | ||
3371 | 158 | |||
3372 | 159 | - Packaging fix | ||
3373 | 160 | |||
3374 | 161 | 0.13.4 (2012-07-27) | ||
3375 | 162 | +++++++++++++++++++ | ||
3376 | 163 | |||
3377 | 164 | - GSSAPI/Kerberos authentication! | ||
3378 | 165 | - App Engine 2.7 Fixes! | ||
3379 | 166 | - Fix leaking connections (from urllib3 update) | ||
3380 | 167 | - OAuthlib path hack fix | ||
3381 | 168 | - OAuthlib URL parameters fix. | ||
3382 | 169 | |||
3383 | 170 | 0.13.3 (2012-07-12) | ||
3384 | 171 | +++++++++++++++++++ | ||
3385 | 172 | |||
3386 | 173 | - Use simplejson if available. | ||
3387 | 174 | - Do not hide SSLErrors behind Timeouts. | ||
3388 | 175 | - Fixed param handling with urls containing fragments. | ||
3389 | 176 | - Significantly improved information in User Agent. | ||
3390 | 177 | - client certificates are ignored when verify=False | ||
3391 | 178 | |||
3392 | 179 | 0.13.2 (2012-06-28) | ||
3393 | 180 | +++++++++++++++++++ | ||
3394 | 181 | |||
3395 | 182 | - Zero dependencies (once again)! | ||
3396 | 183 | - New: Response.reason | ||
3397 | 184 | - Sign querystring parameters in OAuth 1.0 | ||
3398 | 185 | - Client certificates no longer ignored when verify=False | ||
3399 | 186 | - Add openSUSE certificate support | ||
3400 | 187 | |||
3401 | 188 | 0.13.1 (2012-06-07) | ||
3402 | 189 | +++++++++++++++++++ | ||
3403 | 190 | |||
3404 | 191 | - Allow passing a file or file-like object as data. | ||
3405 | 192 | - Allow hooks to return responses that indicate errors. | ||
3406 | 193 | - Fix Response.text and Response.json for body-less responses. | ||
3407 | 194 | |||
3408 | 195 | 0.13.0 (2012-05-29) | ||
3409 | 196 | +++++++++++++++++++ | ||
3410 | 197 | |||
3411 | 198 | - Removal of Requests.async in favor of `grequests <https://github.com/kennethreitz/grequests>`_ | ||
3412 | 199 | - Allow disabling of cookie persistiance. | ||
3413 | 200 | - New implimentation of safe_mode | ||
3414 | 201 | - cookies.get now supports default argument | ||
3415 | 202 | - Session cookies not saved when Session.request is called with return_response=False | ||
3416 | 203 | - Env: no_proxy support. | ||
3417 | 204 | - RequestsCookieJar improvements. | ||
3418 | 205 | - Various bug fixes. | ||
3419 | 206 | |||
3420 | 207 | 0.12.1 (2012-05-08) | ||
3421 | 208 | +++++++++++++++++++ | ||
3422 | 209 | |||
3423 | 210 | - New ``Response.json`` property. | ||
3424 | 211 | - Ability to add string file uploads. | ||
3425 | 212 | - Fix out-of-range issue with iter_lines. | ||
3426 | 213 | - Fix iter_content default size. | ||
3427 | 214 | - Fix POST redirects containing files. | ||
3428 | 215 | |||
3429 | 216 | 0.12.0 (2012-05-02) | ||
3430 | 217 | +++++++++++++++++++ | ||
3431 | 218 | |||
3432 | 219 | - EXPERIMENTAL OAUTH SUPPORT! | ||
3433 | 220 | - Proper CookieJar-backed cookies interface with awesome dict-like interface. | ||
3434 | 221 | - Speed fix for non-iterated content chunks. | ||
3435 | 222 | - Move ``pre_request`` to a more usable place. | ||
3436 | 223 | - New ``pre_send`` hook. | ||
3437 | 224 | - Lazily encode data, params, files. | ||
3438 | 225 | - Load system Certificate Bundle if ``certify`` isn't available. | ||
3439 | 226 | - Cleanups, fixes. | ||
3440 | 227 | |||
3441 | 228 | 0.11.2 (2012-04-22) | ||
3442 | 229 | +++++++++++++++++++ | ||
3443 | 230 | |||
3444 | 231 | - Attempt to use the OS's certificate bundle if ``certifi`` isn't available. | ||
3445 | 232 | - Infinite digest auth redirect fix. | ||
3446 | 233 | - Multi-part file upload improvements. | ||
3447 | 234 | - Fix decoding of invalid %encodings in URLs. | ||
3448 | 235 | - If there is no content in a response don't throw an error the second time that content is attempted to be read. | ||
3449 | 236 | - Upload data on redirects. | ||
3450 | 237 | |||
3451 | 238 | 0.11.1 (2012-03-30) | ||
3452 | 239 | +++++++++++++++++++ | ||
3453 | 240 | |||
3454 | 241 | * POST redirects now break RFC to do what browsers do: Follow up with a GET. | ||
3455 | 242 | * New ``strict_mode`` configuration to disable new redirect behavior. | ||
3456 | 243 | |||
3457 | 244 | |||
3458 | 245 | 0.11.0 (2012-03-14) | ||
3459 | 246 | +++++++++++++++++++ | ||
3460 | 247 | |||
3461 | 248 | * Private SSL Certificate support | ||
3462 | 249 | * Remove select.poll from Gevent monkeypatching | ||
3463 | 250 | * Remove redundant generator for chunked transfer encoding | ||
3464 | 251 | * Fix: Response.ok raises Timeout Exception in safe_mode | ||
3465 | 252 | |||
3466 | 253 | 0.10.8 (2012-03-09) | ||
3467 | 254 | +++++++++++++++++++ | ||
3468 | 255 | |||
3469 | 256 | * Generate chunked ValueError fix | ||
3470 | 257 | * Proxy configuration by environment variables | ||
3471 | 258 | * Simplification of iter_lines. | ||
3472 | 259 | * New `trust_env` configuration for disabling system/environment hints. | ||
3473 | 260 | * Suppress cookie errors. | ||
3474 | 261 | |||
3475 | 262 | 0.10.7 (2012-03-07) | ||
3476 | 263 | +++++++++++++++++++ | ||
3477 | 264 | |||
3478 | 265 | * `encode_uri` = False | ||
3479 | 266 | |||
3480 | 267 | 0.10.6 (2012-02-25) | ||
3481 | 268 | +++++++++++++++++++ | ||
3482 | 269 | |||
3483 | 270 | * Allow '=' in cookies. | ||
3484 | 271 | |||
3485 | 272 | 0.10.5 (2012-02-25) | ||
3486 | 273 | +++++++++++++++++++ | ||
3487 | 274 | |||
3488 | 275 | * Response body with 0 content-length fix. | ||
3489 | 276 | * New async.imap. | ||
3490 | 277 | * Don't fail on netrc. | ||
3491 | 278 | |||
3492 | 279 | |||
3493 | 280 | 0.10.4 (2012-02-20) | ||
3494 | 281 | +++++++++++++++++++ | ||
3495 | 282 | |||
3496 | 283 | * Honor netrc. | ||
3497 | 284 | |||
3498 | 285 | 0.10.3 (2012-02-20) | ||
3499 | 286 | +++++++++++++++++++ | ||
3500 | 287 | |||
3501 | 288 | * HEAD requests don't follow redirects anymore. | ||
3502 | 289 | * raise_for_status() doesn't raise for 3xx anymore. | ||
3503 | 290 | * Make Session objects picklable. | ||
3504 | 291 | * ValueError for invalid schema URLs. | ||
3505 | 292 | |||
3506 | 293 | 0.10.2 (2012-01-15) | ||
3507 | 294 | +++++++++++++++++++ | ||
3508 | 295 | |||
3509 | 296 | * Vastly improved URL quoting. | ||
3510 | 297 | * Additional allowed cookie key values. | ||
3511 | 298 | * Attempted fix for "Too many open files" Error | ||
3512 | 299 | * Replace unicode errors on first pass, no need for second pass. | ||
3513 | 300 | * Append '/' to bare-domain urls before query insertion. | ||
3514 | 301 | * Exceptions now inherit from RuntimeError. | ||
3515 | 302 | * Binary uploads + auth fix. | ||
3516 | 303 | * Bugfixes. | ||
3517 | 304 | |||
3518 | 305 | |||
3519 | 306 | 0.10.1 (2012-01-23) | ||
3520 | 307 | +++++++++++++++++++ | ||
3521 | 308 | |||
3522 | 309 | * PYTHON 3 SUPPORT! | ||
3523 | 310 | * Dropped 2.5 Support. (*Backwards Incompatible*) | ||
3524 | 311 | |||
3525 | 312 | 0.10.0 (2012-01-21) | ||
3526 | 313 | +++++++++++++++++++ | ||
3527 | 314 | |||
3528 | 315 | * ``Response.content`` is now bytes-only. (*Backwards Incompatible*) | ||
3529 | 316 | * New ``Response.text`` is unicode-only. | ||
3530 | 317 | * If no ``Response.encoding`` is specified and ``chardet`` is available, ``Respoonse.text`` will guess an encoding. | ||
3531 | 318 | * Default to ISO-8859-1 (Western) encoding for "text" subtypes. | ||
3532 | 319 | * Removal of `decode_unicode`. (*Backwards Incompatible*) | ||
3533 | 320 | * New multiple-hooks system. | ||
3534 | 321 | * New ``Response.register_hook`` for registering hooks within the pipeline. | ||
3535 | 322 | * ``Response.url`` is now Unicode. | ||
3536 | 323 | |||
3537 | 324 | 0.9.3 (2012-01-18) | ||
3538 | 325 | ++++++++++++++++++ | ||
3539 | 326 | |||
3540 | 327 | * SSL verify=False bugfix (apparent on windows machines). | ||
3541 | 328 | |||
3542 | 329 | 0.9.2 (2012-01-18) | ||
3543 | 330 | ++++++++++++++++++ | ||
3544 | 331 | |||
3545 | 332 | * Asynchronous async.send method. | ||
3546 | 333 | * Support for proper chunk streams with boundaries. | ||
3547 | 334 | * session argument for Session classes. | ||
3548 | 335 | * Print entire hook tracebacks, not just exception instance. | ||
3549 | 336 | * Fix response.iter_lines from pending next line. | ||
3550 | 337 | * Fix but in HTTP-digest auth w/ URI having query strings. | ||
3551 | 338 | * Fix in Event Hooks section. | ||
3552 | 339 | * Urllib3 update. | ||
3553 | 340 | |||
3554 | 341 | |||
3555 | 342 | 0.9.1 (2012-01-06) | ||
3556 | 343 | ++++++++++++++++++ | ||
3557 | 344 | |||
3558 | 345 | * danger_mode for automatic Response.raise_for_status() | ||
3559 | 346 | * Response.iter_lines refactor | ||
3560 | 347 | |||
3561 | 348 | 0.9.0 (2011-12-28) | ||
3562 | 349 | ++++++++++++++++++ | ||
3563 | 350 | |||
3564 | 351 | * verify ssl is default. | ||
3565 | 352 | |||
3566 | 353 | |||
3567 | 354 | 0.8.9 (2011-12-28) | ||
3568 | 355 | ++++++++++++++++++ | ||
3569 | 356 | |||
3570 | 357 | * Packaging fix. | ||
3571 | 358 | |||
3572 | 359 | |||
3573 | 360 | 0.8.8 (2011-12-28) | ||
3574 | 361 | ++++++++++++++++++ | ||
3575 | 362 | |||
3576 | 363 | * SSL CERT VERIFICATION! | ||
3577 | 364 | * Release of Cerifi: Mozilla's cert list. | ||
3578 | 365 | * New 'verify' argument for SSL requests. | ||
3579 | 366 | * Urllib3 update. | ||
3580 | 367 | |||
3581 | 368 | 0.8.7 (2011-12-24) | ||
3582 | 369 | ++++++++++++++++++ | ||
3583 | 370 | |||
3584 | 371 | * iter_lines last-line truncation fix | ||
3585 | 372 | * Force safe_mode for async requests | ||
3586 | 373 | * Handle safe_mode exceptions more consistently | ||
3587 | 374 | * Fix iteration on null responses in safe_mode | ||
3588 | 375 | |||
3589 | 376 | 0.8.6 (2011-12-18) | ||
3590 | 377 | ++++++++++++++++++ | ||
3591 | 378 | |||
3592 | 379 | * Socket timeout fixes. | ||
3593 | 380 | * Proxy Authorization support. | ||
3594 | 381 | |||
3595 | 382 | 0.8.5 (2011-12-14) | ||
3596 | 383 | ++++++++++++++++++ | ||
3597 | 384 | |||
3598 | 385 | * Response.iter_lines! | ||
3599 | 386 | |||
3600 | 387 | 0.8.4 (2011-12-11) | ||
3601 | 388 | ++++++++++++++++++ | ||
3602 | 389 | |||
3603 | 390 | * Prefetch bugfix. | ||
3604 | 391 | * Added license to installed version. | ||
3605 | 392 | |||
3606 | 393 | 0.8.3 (2011-11-27) | ||
3607 | 394 | ++++++++++++++++++ | ||
3608 | 395 | |||
3609 | 396 | * Converted auth system to use simpler callable objects. | ||
3610 | 397 | * New session parameter to API methods. | ||
3611 | 398 | * Display full URL while logging. | ||
3612 | 399 | |||
3613 | 116 | 0.8.2 (2011-11-19) | 400 | 0.8.2 (2011-11-19) |
3614 | 117 | ++++++++++++++++++ | 401 | ++++++++++++++++++ |
3615 | 118 | 402 | ||
3617 | 119 | * New unicode decoding system, based on overridable `Response.encoding`. | 403 | * New Unicode decoding system, based on over-ridable `Response.encoding`. |
3618 | 120 | * Proper URL slash-quote handling. | 404 | * Proper URL slash-quote handling. |
3619 | 121 | * Cookies with ``[``, ``]``, and ``_`` allowed. | 405 | * Cookies with ``[``, ``]``, and ``_`` allowed. |
3620 | 122 | 406 | ||
3621 | @@ -140,6 +424,7 @@ | |||
3622 | 140 | * OPTION method | 424 | * OPTION method |
3623 | 141 | * Async pool size throttling | 425 | * Async pool size throttling |
3624 | 142 | * File uploads send real names | 426 | * File uploads send real names |
3625 | 427 | * Vendored in urllib3 | ||
3626 | 143 | 428 | ||
3627 | 144 | 0.7.6 (2011-11-07) | 429 | 0.7.6 (2011-11-07) |
3628 | 145 | ++++++++++++++++++ | 430 | ++++++++++++++++++ |
3629 | @@ -155,7 +440,7 @@ | |||
3630 | 155 | 0.7.4 (2011-10-26) | 440 | 0.7.4 (2011-10-26) |
3631 | 156 | ++++++++++++++++++ | 441 | ++++++++++++++++++ |
3632 | 157 | 442 | ||
3634 | 158 | * Sesion Hooks fix. | 443 | * Session Hooks fix. |
3635 | 159 | 444 | ||
3636 | 160 | 0.7.3 (2011-10-23) | 445 | 0.7.3 (2011-10-23) |
3637 | 161 | ++++++++++++++++++ | 446 | ++++++++++++++++++ |
3638 | @@ -386,6 +671,10 @@ | |||
3639 | 386 | Classifier: Natural Language :: English | 671 | Classifier: Natural Language :: English |
3640 | 387 | Classifier: License :: OSI Approved :: ISC License (ISCL) | 672 | Classifier: License :: OSI Approved :: ISC License (ISCL) |
3641 | 388 | Classifier: Programming Language :: Python | 673 | Classifier: Programming Language :: Python |
3642 | 389 | Classifier: Programming Language :: Python :: 2.5 | ||
3643 | 390 | Classifier: Programming Language :: Python :: 2.6 | 674 | Classifier: Programming Language :: Python :: 2.6 |
3644 | 391 | Classifier: Programming Language :: Python :: 2.7 | 675 | Classifier: Programming Language :: Python :: 2.7 |
3645 | 676 | Classifier: Programming Language :: Python :: 3 | ||
3646 | 677 | Classifier: Programming Language :: Python :: 3.0 | ||
3647 | 678 | Classifier: Programming Language :: Python :: 3.1 | ||
3648 | 679 | Classifier: Programming Language :: Python :: 3.2 | ||
3649 | 680 | Classifier: Programming Language :: Python :: 3.3 | ||
3650 | 392 | 681 | ||
3651 | === modified file 'README.rst' | |||
3652 | --- README.rst 2011-11-25 00:02:28 +0000 | |||
3653 | +++ README.rst 2013-01-28 21:06:46 +0000 | |||
3654 | @@ -1,6 +1,10 @@ | |||
3655 | 1 | Requests: HTTP for Humans | 1 | Requests: HTTP for Humans |
3656 | 2 | ========================= | 2 | ========================= |
3657 | 3 | 3 | ||
3658 | 4 | |||
3659 | 5 | .. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop | ||
3660 | 6 | :target: https://secure.travis-ci.org/kennethreitz/requests | ||
3661 | 7 | |||
3662 | 4 | Requests is an ISC Licensed HTTP library, written in Python, for human | 8 | Requests is an ISC Licensed HTTP library, written in Python, for human |
3663 | 5 | beings. | 9 | beings. |
3664 | 6 | 10 | ||
3665 | @@ -19,60 +23,32 @@ | |||
3666 | 19 | 204 | 23 | 204 |
3667 | 20 | >>> r.headers['content-type'] | 24 | >>> r.headers['content-type'] |
3668 | 21 | 'application/json' | 25 | 'application/json' |
3670 | 22 | >>> r.content | 26 | >>> r.text |
3671 | 23 | ... | 27 | ... |
3672 | 24 | 28 | ||
3673 | 25 | See `the same code, without Requests <https://gist.github.com/973705>`_. | 29 | See `the same code, without Requests <https://gist.github.com/973705>`_. |
3674 | 26 | 30 | ||
3677 | 27 | Requests allow you to send **HEAD**, **GET**, **POST**, **PUT**, | 31 | Requests allow you to send HTTP/1.1 requests. You can add headers, form data, |
3676 | 28 | **PATCH**, and **DELETE** HTTP requests. You can add headers, form data, | ||
3678 | 29 | multipart files, and parameters with simple Python dictionaries, and access the | 32 | multipart files, and parameters with simple Python dictionaries, and access the |
3681 | 30 | response data in the same way. It's powered by httplib, but it does | 33 | response data in the same way. It's powered by httplib and `urllib3 |
3682 | 31 | all the hard work and crazy hacks for you. | 34 | <https://github.com/shazow/urllib3>`_, but it does all the hard work and crazy |
3683 | 35 | hacks for you. | ||
3684 | 32 | 36 | ||
3685 | 33 | 37 | ||
3686 | 34 | Features | 38 | Features |
3687 | 35 | -------- | 39 | -------- |
3688 | 36 | 40 | ||
3728 | 37 | - Extremely simple HEAD, GET, POST, PUT, PATCH, DELETE Requests. | 41 | - International Domains and URLs |
3729 | 38 | - Gevent support for Asyncronous Requests. | 42 | - Keep-Alive & Connection Pooling |
3730 | 39 | - Sessions with cookie persistience. | 43 | - Sessions with Cookie Persistence |
3731 | 40 | - Basic, Digest, and Custom Authentication support. | 44 | - Browser-style SSL Verification |
3732 | 41 | - Automatic form-encoding of dictionaries | 45 | - Basic/Digest Authentication |
3733 | 42 | - A simple dictionary interface for request/response cookies. | 46 | - Elegant Key/Value Cookies |
3734 | 43 | - Multipart file uploads. | 47 | - Automatic Decompression |
3735 | 44 | - Automatc decoding of Unicode, gzip, and deflate responses. | 48 | - Unicode Response Bodies |
3736 | 45 | - Full support for unicode URLs and domain names. | 49 | - Multipart File Uploads |
3737 | 46 | 50 | - Connection Timeouts | |
3738 | 47 | 51 | - Thread-safety | |
3700 | 48 | Usage | ||
3701 | 49 | ----- | ||
3702 | 50 | |||
3703 | 51 | It couldn't be simpler. :: | ||
3704 | 52 | |||
3705 | 53 | >>> import requests | ||
3706 | 54 | >>> r = requests.get('http://google.com') | ||
3707 | 55 | |||
3708 | 56 | |||
3709 | 57 | HTTPS? Basic Authentication? :: | ||
3710 | 58 | |||
3711 | 59 | >>> r = requests.get('https://httpbin.ep.io/basic-auth/user/pass') | ||
3712 | 60 | >>> r.status_code | ||
3713 | 61 | 401 | ||
3714 | 62 | |||
3715 | 63 | |||
3716 | 64 | Uh oh, we're not authorized! Let's add authentication. :: | ||
3717 | 65 | |||
3718 | 66 | >>> r = requests.get('https://httpbin.ep.io/basic-auth/user/pass', auth=('user', 'pass')) | ||
3719 | 67 | |||
3720 | 68 | >>> r.status_code | ||
3721 | 69 | 200 | ||
3722 | 70 | |||
3723 | 71 | >>> r.headers['content-type'] | ||
3724 | 72 | 'application/json' | ||
3725 | 73 | |||
3726 | 74 | >>> r.content | ||
3727 | 75 | '{"authenticated": true, "user": "user"}' | ||
3739 | 76 | 52 | ||
3740 | 77 | 53 | ||
3741 | 78 | Installation | 54 | Installation |
3742 | @@ -99,4 +75,4 @@ | |||
3743 | 99 | #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. | 75 | #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. |
3744 | 100 | 76 | ||
3745 | 101 | .. _`the repository`: http://github.com/kennethreitz/requests | 77 | .. _`the repository`: http://github.com/kennethreitz/requests |
3747 | 102 | .. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORS | 78 | .. _AUTHORS: https://github.com/kennethreitz/requests/blob/develop/AUTHORS.rst |
3748 | 103 | 79 | ||
3749 | === modified file 'debian/changelog' | |||
3750 | --- debian/changelog 2011-11-25 00:02:28 +0000 | |||
3751 | +++ debian/changelog 2013-01-28 21:06:46 +0000 | |||
3752 | @@ -1,3 +1,140 @@ | |||
3753 | 1 | requests (0.14.2-0ubuntu1~cloud0) precise-grizzly; urgency=low | ||
3754 | 2 | |||
3755 | 3 | * New upstream release for the Ubuntu Cloud Archvie: | ||
3756 | 4 | - Removed python3 version. | ||
3757 | 5 | |||
3758 | 6 | -- Chuck Short <zulcss@ubuntu.com> Mon, 28 Jan 2013 14:58:12 -0600 | ||
3759 | 7 | |||
3760 | 8 | requests (0.14.2-0ubuntu1) raring; urgency=low | ||
3761 | 9 | |||
3762 | 10 | * New upstream release (LP: #1076107). Remaining changes: | ||
3763 | 11 | - debian/patches/01_do-not-use-python-certifi.patch: No longer necessary. | ||
3764 | 12 | - debian/patches/02_do-not-use-embedded-python-six.patch: refreshed | ||
3765 | 13 | - debian/patches/03-dont-use-embeded-urllib3.patch: refreshed and | ||
3766 | 14 | renamed to 03-use-distro-packages.patch | ||
3767 | 15 | - debian/control: python-chardet and python3-chardet are now required | ||
3768 | 16 | (i.e. Depends instead of Recommends). | ||
3769 | 17 | |||
3770 | 18 | -- Barry Warsaw <barry@ubuntu.com> Thu, 01 Nov 2012 14:56:00 +0100 | ||
3771 | 19 | |||
3772 | 20 | requests (0.12.1-1ubuntu6) quantal; urgency=low | ||
3773 | 21 | |||
3774 | 22 | * debian/control: Resolve Depends misspelling of python-urllib3. | ||
3775 | 23 | |||
3776 | 24 | -- Dave Walker (Daviey) <DaveWalker@ubuntu.com> Thu, 13 Sep 2012 14:55:21 +0100 | ||
3777 | 25 | |||
3778 | 26 | requests (0.12.1-1ubuntu5) quantal; urgency=low | ||
3779 | 27 | |||
3780 | 28 | * Add -r to rm call in debian/rules removing requests/packages/urllib3 | ||
3781 | 29 | * Add python3-urllib3 to build-depends and python3-requests depends | ||
3782 | 30 | |||
3783 | 31 | -- Adam Conrad <adconrad@ubuntu.com> Wed, 12 Sep 2012 23:05:13 -0600 | ||
3784 | 32 | |||
3785 | 33 | requests (0.12.1-1ubuntu4) quantal; urgency=low | ||
3786 | 34 | |||
3787 | 35 | * debian/rules, debian/control, | ||
3788 | 36 | debian/patches/03-dont-use-embeded-urllib3.patch: | ||
3789 | 37 | Don't use embeded python-urllib3. | ||
3790 | 38 | |||
3791 | 39 | -- Chuck Short <zulcss@ubuntu.com> Fri, 07 Sep 2012 09:06:26 -0500 | ||
3792 | 40 | |||
3793 | 41 | requests (0.12.1-1ubuntu3) quantal; urgency=low | ||
3794 | 42 | |||
3795 | 43 | * d/{rules,control}: Disable tests and drop associated deps; 10/11 | ||
3796 | 44 | of them require network connectivity so they break in offline build | ||
3797 | 45 | environments. | ||
3798 | 46 | |||
3799 | 47 | -- James Page <james.page@ubuntu.com> Tue, 14 Aug 2012 12:39:19 +0100 | ||
3800 | 48 | |||
3801 | 49 | requests (0.12.1-1ubuntu2) quantal; urgency=low | ||
3802 | 50 | |||
3803 | 51 | * debian/control: Fix up testsuite some more. | ||
3804 | 52 | |||
3805 | 53 | -- Chuck Short <zulcss@ubuntu.com> Wed, 18 Jul 2012 14:25:42 -0500 | ||
3806 | 54 | |||
3807 | 55 | requests (0.12.1-1ubuntu1) quantal; urgency=low | ||
3808 | 56 | |||
3809 | 57 | * debia/rules: Enable test suite. | ||
3810 | 58 | |||
3811 | 59 | -- Chuck Short <zulcss@ubuntu.com> Mon, 11 Jun 2012 09:18:06 -0400 | ||
3812 | 60 | |||
3813 | 61 | requests (0.12.1-1) unstable; urgency=low | ||
3814 | 62 | |||
3815 | 63 | * New upstream release | ||
3816 | 64 | * debian/control | ||
3817 | 65 | - Added python-oauthlib to python-requests' Recommends field | ||
3818 | 66 | * debian/patches/01_do-not-use-python-certifi.patch | ||
3819 | 67 | - Refreshed | ||
3820 | 68 | |||
3821 | 69 | -- Daniele Tricoli <eriol@mornie.org> Fri, 04 May 2012 14:34:47 +0200 | ||
3822 | 70 | |||
3823 | 71 | requests (0.11.2-1) unstable; urgency=low | ||
3824 | 72 | |||
3825 | 73 | * New upstream release | ||
3826 | 74 | * debian/patches/01_do-not-use-python-certifi.patch | ||
3827 | 75 | - Refreshed | ||
3828 | 76 | |||
3829 | 77 | -- Daniele Tricoli <eriol@mornie.org> Mon, 23 Apr 2012 16:06:33 +0200 | ||
3830 | 78 | |||
3831 | 79 | requests (0.11.1-1) unstable; urgency=low | ||
3832 | 80 | |||
3833 | 81 | * New upstream release | ||
3834 | 82 | * debian/control | ||
3835 | 83 | - Added python3-chardet to python3-requests' Recommends field | ||
3836 | 84 | - Updated Description field | ||
3837 | 85 | * debian/patches/02_do-not-use-embedded-python-six.patch | ||
3838 | 86 | - Refreshed | ||
3839 | 87 | |||
3840 | 88 | -- Daniele Tricoli <eriol@mornie.org> Sun, 01 Apr 2012 12:33:42 +0200 | ||
3841 | 89 | |||
3842 | 90 | requests (0.10.8-1) unstable; urgency=low | ||
3843 | 91 | |||
3844 | 92 | [ Piotr Ożarowski ] | ||
3845 | 93 | * Fix typo in python3-requests' ${python3:Depends} | ||
3846 | 94 | |||
3847 | 95 | [ Daniele Tricoli ] | ||
3848 | 96 | * New upstream release (Closes: #663561) | ||
3849 | 97 | * Removed embedded copy of python-six | ||
3850 | 98 | - Added debian/patches/02_do-not-use-embedded-python-six.patch | ||
3851 | 99 | - Added override_dh_auto_configure to debian/rules to remove | ||
3852 | 100 | the embedded copy | ||
3853 | 101 | - Added python(3)-six to Builds-Depends and Depends | ||
3854 | 102 | * debian/control | ||
3855 | 103 | - Bumped Standards-Version to 3.9.3 (no changes needed) | ||
3856 | 104 | * debian/copyright | ||
3857 | 105 | - Added forgotten stanzas about packages inside the fork | ||
3858 | 106 | of python-urllib3 | ||
3859 | 107 | * debian/patches/01_do-not-use-python-certifi.patch | ||
3860 | 108 | - Refreshed | ||
3861 | 109 | * debian/patches/02_fix-python3-except-sintax-error.patch | ||
3862 | 110 | - Removed as it is applied upstream | ||
3863 | 111 | |||
3864 | 112 | -- Daniele Tricoli <eriol@mornie.org> Mon, 19 Mar 2012 01:20:59 +0100 | ||
3865 | 113 | |||
3866 | 114 | requests (0.10.1-1) unstable; urgency=low | ||
3867 | 115 | |||
3868 | 116 | * New upstream release | ||
3869 | 117 | - Adds Python 3 support | ||
3870 | 118 | * Builded python 3 package | ||
3871 | 119 | * debian/control | ||
3872 | 120 | - Added python-chardet to Recommends | ||
3873 | 121 | - Bumped X-Python-Version >= 2.6 | ||
3874 | 122 | - Added ca-certificates to Depends | ||
3875 | 123 | - Added python3-all to Build-Depends | ||
3876 | 124 | * debian/copyright | ||
3877 | 125 | - Updated Format URI | ||
3878 | 126 | - Updated copyright years | ||
3879 | 127 | * debian/patches/01_do-not-use-python-certifi.patch | ||
3880 | 128 | - To verify SSL certificates for HTTPS requests, use the bundle provided by | ||
3881 | 129 | ca-certificates instead of python-certifi | ||
3882 | 130 | * debian/patches/02_fix-python3-except-sintax-error.patches | ||
3883 | 131 | - Fix SyntaxError on Python3 because "except Error, e" is not supported | ||
3884 | 132 | anymore | ||
3885 | 133 | * debian/rules | ||
3886 | 134 | - Added override_dh_auto_clean to make the package build twice in a row | ||
3887 | 135 | |||
3888 | 136 | -- Daniele Tricoli <eriol@mornie.org> Sun, 05 Feb 2012 04:51:38 +0100 | ||
3889 | 137 | |||
3890 | 1 | requests (0.8.2-1) unstable; urgency=low | 138 | requests (0.8.2-1) unstable; urgency=low |
3891 | 2 | 139 | ||
3892 | 3 | * New upstream release | 140 | * New upstream release |
3893 | 4 | 141 | ||
3894 | === modified file 'debian/control' | |||
3895 | --- debian/control 2011-10-19 20:49:39 +0000 | |||
3896 | +++ debian/control 2013-01-28 21:06:46 +0000 | |||
3897 | @@ -1,37 +1,52 @@ | |||
3898 | 1 | Source: requests | 1 | Source: requests |
3900 | 2 | Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> | 2 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
3901 | 3 | XSBC-Original-Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> | ||
3902 | 3 | Uploaders: Daniele Tricoli <eriol@mornie.org> | 4 | Uploaders: Daniele Tricoli <eriol@mornie.org> |
3903 | 4 | Section: python | 5 | Section: python |
3904 | 5 | Priority: optional | 6 | Priority: optional |
3909 | 6 | Build-Depends: debhelper (>= 7.0.50~), | 7 | Build-Depends: |
3910 | 7 | python-all (>= 2.6.6-3), | 8 | debhelper (>= 7.0.50~), |
3911 | 8 | Standards-Version: 3.9.2 | 9 | python-all (>= 2.6.6-3), |
3912 | 9 | X-Python-Version: >= 2.5 | 10 | python-six, |
3913 | 11 | python-chardet, | ||
3914 | 12 | python-urllib3, | ||
3915 | 13 | python-gevent, | ||
3916 | 14 | python-oauthlib, | ||
3917 | 15 | ca-certificates | ||
3918 | 16 | Standards-Version: 3.9.3 | ||
3919 | 17 | X-Python-Version: >= 2.6 | ||
3920 | 18 | X-Python3-Version: >= 3.0 | ||
3921 | 10 | Homepage: http://python-requests.org | 19 | Homepage: http://python-requests.org |
3922 | 11 | Vcs-Svn: svn://svn.debian.org/python-modules/packages/requests/trunk/ | 20 | Vcs-Svn: svn://svn.debian.org/python-modules/packages/requests/trunk/ |
3923 | 12 | Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/requests/trunk/ | 21 | Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/requests/trunk/ |
3924 | 13 | 22 | ||
3925 | 14 | Package: python-requests | 23 | Package: python-requests |
3926 | 15 | Architecture: all | 24 | Architecture: all |
3929 | 16 | Depends: ${misc:Depends}, ${python:Depends} | 25 | Depends: |
3930 | 17 | Recommends: python-gevent | 26 | ${misc:Depends}, |
3931 | 27 | ${python:Depends}, | ||
3932 | 28 | ca-certificates, | ||
3933 | 29 | python-urllib3, | ||
3934 | 30 | python-six, | ||
3935 | 31 | python-chardet | ||
3936 | 32 | Recommends: | ||
3937 | 33 | python-gevent, | ||
3938 | 34 | python-oauthlib | ||
3939 | 18 | Description: elegant and simple HTTP library for Python, built for human beings | 35 | Description: elegant and simple HTTP library for Python, built for human beings |
3945 | 19 | Requests allow you to send GET, HEAD, PUT, POST, and DELETE | 36 | Requests allow you to send HTTP/1.1 requests. You can add headers, form data, |
3946 | 20 | HTTP requests. You can add headers, form data, multipart files, and | 37 | multipart files, and parameters with simple Python dictionaries, and access the |
3947 | 21 | parameters with simple Python dictionaries, and access the response | 38 | response data in the same way. It's powered by httplib and urllib3, but it does |
3948 | 22 | data in the same way. It's powered by urllib2, but it does all the | 39 | all the hard work and crazy hacks for you. |
3944 | 23 | hard work and crazy hacks for you. | ||
3949 | 24 | . | 40 | . |
3950 | 25 | Features | 41 | Features |
3951 | 26 | . | 42 | . |
3963 | 27 | - Extremely simple GET, HEAD, POST, PUT, DELETE Requests | 43 | - International Domains and URLs |
3964 | 28 | - Simple HTTP Header Request Attachment | 44 | - Keep-Alive & Connection Pooling |
3965 | 29 | - Simple Data/Params Request Attachment | 45 | - Sessions with Cookie Persistence |
3966 | 30 | - Simple Multipart File Uploads | 46 | - Browser-style SSL Verification |
3967 | 31 | - CookieJar Support | 47 | - Basic/Digest Authentication |
3968 | 32 | - Redirection History | 48 | - Elegant Key/Value Cookies |
3969 | 33 | - Proxy Support | 49 | - Automatic Decompression |
3970 | 34 | - Redirection Recursion Urllib Fix | 50 | - Unicode Response Bodies |
3971 | 35 | - Auto Decompression of GZipped Content | 51 | - Multipart File Uploads |
3972 | 36 | - Unicode URL Support | 52 | - Connection Timeouts |
3962 | 37 | - Simple Authentication: Simple URL + HTTP Auth Registry | ||
3973 | 38 | 53 | ||
3974 | === modified file 'debian/copyright' | |||
3975 | --- debian/copyright 2011-11-25 00:02:28 +0000 | |||
3976 | +++ debian/copyright 2013-01-28 21:06:46 +0000 | |||
3977 | @@ -1,18 +1,30 @@ | |||
3979 | 1 | Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174 | 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ |
3980 | 2 | Upstream-Name: requests | 2 | Upstream-Name: requests |
3981 | 3 | Upstream-Contact: Kenneth Reitz <me@kennethreitz.com> | 3 | Upstream-Contact: Kenneth Reitz <me@kennethreitz.com> |
3982 | 4 | Source: http://pypi.python.org/pypi/requests | 4 | Source: http://pypi.python.org/pypi/requests |
3983 | 5 | 5 | ||
3984 | 6 | Files: * | 6 | Files: * |
3986 | 7 | Copyright: © 2011 Kenneth Reitz | 7 | Copyright: 2011-2012, Kenneth Reitz |
3987 | 8 | License: ISC | 8 | License: ISC |
3988 | 9 | 9 | ||
3989 | 10 | Files: requests/packages/urllib3/* | 10 | Files: requests/packages/urllib3/* |
3991 | 11 | Copyright: © 2008-2011 Andrey Petrov | 11 | Copyright: 2008-2011, Andrey Petrov |
3992 | 12 | License: Expat | ||
3993 | 13 | |||
3994 | 14 | Files: requests/packages/urllib3/packages/mimetools_choose_boundary/__init__.py | ||
3995 | 15 | Copyright: 2010, Python Software Foundation | ||
3996 | 16 | License: PSF-2 | ||
3997 | 17 | |||
3998 | 18 | Files: requests/packages/urllib3/packages/ssl_match_hostname/__init__.py | ||
3999 | 19 | Copyright: 2011, Python Software Foundation | ||
4000 | 20 | License: PSF-2 | ||
4001 | 21 | |||
4002 | 22 | Files: requests/packages/urllib3/packages/six.py | ||
4003 | 23 | Copyright: 2010-2011, Benjamin Peterson | ||
4004 | 12 | License: Expat | 24 | License: Expat |
4005 | 13 | 25 | ||
4006 | 14 | Files: requests/packages/oreos/monkeys.py | 26 | Files: requests/packages/oreos/monkeys.py |
4008 | 15 | Copyright: © 2000 Timothy O'Malley | 27 | Copyright: 2000, Timothy O'Malley |
4009 | 16 | License: | 28 | License: |
4010 | 17 | Permission to use, copy, modify, and distribute this software | 29 | Permission to use, copy, modify, and distribute this software |
4011 | 18 | and its documentation for any purpose and without fee is hereby | 30 | and its documentation for any purpose and without fee is hereby |
4012 | @@ -33,7 +45,7 @@ | |||
4013 | 33 | PERFORMANCE OF THIS SOFTWARE. | 45 | PERFORMANCE OF THIS SOFTWARE. |
4014 | 34 | 46 | ||
4015 | 35 | Files: debian/* | 47 | Files: debian/* |
4017 | 36 | Copyright: © 2011 Daniele Tricoli <eriol@mornie.org> | 48 | Copyright: 2011-2012, Daniele Tricoli <eriol@mornie.org> |
4018 | 37 | License: ISC | 49 | License: ISC |
4019 | 38 | 50 | ||
4020 | 39 | License: ISC | 51 | License: ISC |
4021 | @@ -68,3 +80,49 @@ | |||
4022 | 68 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | 80 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
4023 | 69 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | 81 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
4024 | 70 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 82 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
4025 | 83 | |||
4026 | 84 | License: PSF-2 | ||
4027 | 85 | 1. This LICENSE AGREEMENT is between the Python Software Foundation | ||
4028 | 86 | ("PSF"), and the Individual or Organization ("Licensee") accessing | ||
4029 | 87 | and otherwise using this software ("Python") in source or binary form | ||
4030 | 88 | and its associated documentation. | ||
4031 | 89 | . | ||
4032 | 90 | 2. Subject to the terms and conditions of this License Agreement, PSF | ||
4033 | 91 | hereby grants Licensee a nonexclusive, royalty-free, world-wide | ||
4034 | 92 | license to reproduce, analyze, test, perform and/or display publicly, | ||
4035 | 93 | prepare derivative works, distribute, and otherwise use Python alone | ||
4036 | 94 | or in any derivative version, provided, however, that PSF's License | ||
4037 | 95 | Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, | ||
4038 | 96 | 2002, 2003, 2004, 2005, 2006 Python Software Foundation; All Rights | ||
4039 | 97 | Reserved" are retained in Python alone or in any derivative version | ||
4040 | 98 | prepared by Licensee. | ||
4041 | 99 | . | ||
4042 | 100 | 3. In the event Licensee prepares a derivative work that is based on | ||
4043 | 101 | or incorporates Python or any part thereof, and wants to make the | ||
4044 | 102 | derivative work available to others as provided herein, then Licensee | ||
4045 | 103 | hereby agrees to include in any such work a brief summary of the | ||
4046 | 104 | changes made to Python. | ||
4047 | 105 | . | ||
4048 | 106 | 4. PSF is making Python available to Licensee on an "AS IS" | ||
4049 | 107 | basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR | ||
4050 | 108 | IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND | ||
4051 | 109 | DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR | ||
4052 | 110 | FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT | ||
4053 | 111 | INFRINGE ANY THIRD PARTY RIGHTS. | ||
4054 | 112 | . | ||
4055 | 113 | 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON | ||
4056 | 114 | FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A | ||
4057 | 115 | RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY | ||
4058 | 116 | DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. | ||
4059 | 117 | . | ||
4060 | 118 | 6. This License Agreement will automatically terminate upon a | ||
4061 | 119 | material breach of its terms and conditions. | ||
4062 | 120 | . | ||
4063 | 121 | 7. Nothing in this License Agreement shall be deemed to create any | ||
4064 | 122 | relationship of agency, partnership, or joint venture between PSF and | ||
4065 | 123 | Licensee. This License Agreement does not grant permission to use PSF | ||
4066 | 124 | trademarks or trade name in a trademark sense to endorse or promote | ||
4067 | 125 | products or services of Licensee, or any third party. | ||
4068 | 126 | . | ||
4069 | 127 | 8. By copying, installing or otherwise using Python, Licensee agrees | ||
4070 | 128 | to be bound by the terms and conditions of this License Agreement. | ||
4071 | 71 | 129 | ||
4072 | === added directory 'debian/patches' | |||
4073 | === added file 'debian/patches/02_do-not-use-embedded-python-six.patch' | |||
4074 | --- debian/patches/02_do-not-use-embedded-python-six.patch 1970-01-01 00:00:00 +0000 | |||
4075 | +++ debian/patches/02_do-not-use-embedded-python-six.patch 2013-01-28 21:06:46 +0000 | |||
4076 | @@ -0,0 +1,51 @@ | |||
4077 | 1 | Description: Do not use embedded copy of python-six. | ||
4078 | 2 | Author: Daniele Tricoli <eriol@mornie.org> | ||
4079 | 3 | Forwarded: not-needed | ||
4080 | 4 | Last-Update: 2012-03-19 | ||
4081 | 5 | |||
4082 | 6 | --- a/requests/packages/urllib3/connectionpool.py | ||
4083 | 7 | +++ b/requests/packages/urllib3/connectionpool.py | ||
4084 | 8 | @@ -52,7 +52,7 @@ | ||
4085 | 9 | ) | ||
4086 | 10 | |||
4087 | 11 | from .packages.ssl_match_hostname import match_hostname, CertificateError | ||
4088 | 12 | -from .packages import six | ||
4089 | 13 | +import six | ||
4090 | 14 | |||
4091 | 15 | |||
4092 | 16 | xrange = six.moves.xrange | ||
4093 | 17 | --- a/requests/packages/urllib3/filepost.py | ||
4094 | 18 | +++ b/requests/packages/urllib3/filepost.py | ||
4095 | 19 | @@ -10,8 +10,8 @@ | ||
4096 | 20 | from uuid import uuid4 | ||
4097 | 21 | from io import BytesIO | ||
4098 | 22 | |||
4099 | 23 | -from .packages import six | ||
4100 | 24 | -from .packages.six import b | ||
4101 | 25 | +import six | ||
4102 | 26 | +from six import b | ||
4103 | 27 | |||
4104 | 28 | writer = codecs.lookup('utf-8')[3] | ||
4105 | 29 | |||
4106 | 30 | --- a/requests/packages/urllib3/response.py | ||
4107 | 31 | +++ b/requests/packages/urllib3/response.py | ||
4108 | 32 | @@ -11,7 +11,7 @@ | ||
4109 | 33 | from io import BytesIO | ||
4110 | 34 | |||
4111 | 35 | from .exceptions import DecodeError | ||
4112 | 36 | -from .packages.six import string_types as basestring | ||
4113 | 37 | +from six import string_types as basestring | ||
4114 | 38 | |||
4115 | 39 | |||
4116 | 40 | log = logging.getLogger(__name__) | ||
4117 | 41 | --- a/requests/packages/urllib3/util.py | ||
4118 | 42 | +++ b/requests/packages/urllib3/util.py | ||
4119 | 43 | @@ -18,7 +18,7 @@ | ||
4120 | 44 | except ImportError: # `select` doesn't exist on AppEngine. | ||
4121 | 45 | select = False | ||
4122 | 46 | |||
4123 | 47 | -from .packages import six | ||
4124 | 48 | +import six | ||
4125 | 49 | from .exceptions import LocationParseError | ||
4126 | 50 | |||
4127 | 51 | |||
4128 | 0 | 52 | ||
4129 | === added file 'debian/patches/03-use-distro-packages.patch' | |||
4130 | --- debian/patches/03-use-distro-packages.patch 1970-01-01 00:00:00 +0000 | |||
4131 | +++ debian/patches/03-use-distro-packages.patch 2013-01-28 21:06:46 +0000 | |||
4132 | @@ -0,0 +1,127 @@ | |||
4133 | 1 | Description: Do not use embeded copy of python-urllib3 | ||
4134 | 2 | Author: Chuck Short <zulcss@ubuntu.com> | ||
4135 | 3 | Forwarded: non-need | ||
4136 | 4 | Last-Update: 2012-09-05 | ||
4137 | 5 | --- a/requests/models.py | ||
4138 | 6 | +++ b/requests/models.py | ||
4139 | 7 | @@ -18,12 +18,12 @@ | ||
4140 | 8 | |||
4141 | 9 | from .auth import HTTPBasicAuth, HTTPProxyAuth | ||
4142 | 10 | from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header | ||
4143 | 11 | -from .packages.urllib3.exceptions import MaxRetryError, LocationParseError | ||
4144 | 12 | -from .packages.urllib3.exceptions import TimeoutError | ||
4145 | 13 | -from .packages.urllib3.exceptions import SSLError as _SSLError | ||
4146 | 14 | -from .packages.urllib3.exceptions import HTTPError as _HTTPError | ||
4147 | 15 | -from .packages.urllib3 import connectionpool, poolmanager | ||
4148 | 16 | -from .packages.urllib3.filepost import encode_multipart_formdata | ||
4149 | 17 | +from urllib3.exceptions import MaxRetryError, LocationParseError | ||
4150 | 18 | +from urllib3.exceptions import TimeoutError | ||
4151 | 19 | +from urllib3.exceptions import SSLError as _SSLError | ||
4152 | 20 | +from urllib3.exceptions import HTTPError as _HTTPError | ||
4153 | 21 | +from urllib3 import connectionpool, poolmanager | ||
4154 | 22 | +from urllib3.filepost import encode_multipart_formdata | ||
4155 | 23 | from .defaults import SCHEMAS | ||
4156 | 24 | from .exceptions import ( | ||
4157 | 25 | ConnectionError, HTTPError, RequestException, Timeout, TooManyRedirects, | ||
4158 | 26 | --- a/requests/sessions.py | ||
4159 | 27 | +++ b/requests/sessions.py | ||
4160 | 28 | @@ -16,7 +16,7 @@ | ||
4161 | 29 | from .models import Request | ||
4162 | 30 | from .hooks import dispatch_hook | ||
4163 | 31 | from .utils import header_expand, from_key_val_list | ||
4164 | 32 | -from .packages.urllib3.poolmanager import PoolManager | ||
4165 | 33 | +from urllib3.poolmanager import PoolManager | ||
4166 | 34 | |||
4167 | 35 | |||
4168 | 36 | def merge_kwargs(local_kwarg, default_kwarg): | ||
4169 | 37 | --- a/setup.py | ||
4170 | 38 | +++ b/setup.py | ||
4171 | 39 | @@ -20,24 +20,9 @@ | ||
4172 | 40 | packages = [ | ||
4173 | 41 | 'requests', | ||
4174 | 42 | 'requests.packages', | ||
4175 | 43 | - 'requests.packages.urllib3', | ||
4176 | 44 | - 'requests.packages.urllib3.packages', | ||
4177 | 45 | - 'requests.packages.urllib3.packages.ssl_match_hostname' | ||
4178 | 46 | ] | ||
4179 | 47 | |||
4180 | 48 | -if is_py2: | ||
4181 | 49 | - packages.extend([ | ||
4182 | 50 | - 'requests.packages.oauthlib', | ||
4183 | 51 | - 'requests.packages.oauthlib.oauth1', | ||
4184 | 52 | - 'requests.packages.oauthlib.oauth1.rfc5849', | ||
4185 | 53 | - 'requests.packages.oauthlib.oauth2', | ||
4186 | 54 | - 'requests.packages.oauthlib.oauth2.draft25', | ||
4187 | 55 | - 'requests.packages.chardet', | ||
4188 | 56 | - ]) | ||
4189 | 57 | -else: | ||
4190 | 58 | - packages.append('requests.packages.chardet2') | ||
4191 | 59 | - | ||
4192 | 60 | -requires = [] | ||
4193 | 61 | +requires = ['python-urllib3'] | ||
4194 | 62 | |||
4195 | 63 | setup( | ||
4196 | 64 | name='requests', | ||
4197 | 65 | --- a/requests/adapters.py | ||
4198 | 66 | +++ b/requests/adapters.py | ||
4199 | 67 | @@ -8,7 +8,7 @@ | ||
4200 | 68 | and maintain connections. | ||
4201 | 69 | """ | ||
4202 | 70 | |||
4203 | 71 | -from .packages.urllib3.poolmanager import PoolManager | ||
4204 | 72 | +from urllib3.poolmanager import PoolManager | ||
4205 | 73 | |||
4206 | 74 | class BaseAdapter(object): | ||
4207 | 75 | """The Base Transport Adapter""" | ||
4208 | 76 | --- a/requests/compat.py | ||
4209 | 77 | +++ b/requests/compat.py | ||
4210 | 78 | @@ -92,8 +92,20 @@ | ||
4211 | 79 | try: | ||
4212 | 80 | import cchardet as chardet | ||
4213 | 81 | except ImportError: | ||
4214 | 82 | - from .packages import chardet | ||
4215 | 83 | - from .packages.urllib3.packages.ordered_dict import OrderedDict | ||
4216 | 84 | + import chardet | ||
4217 | 85 | + # Here's the problem. Generally we want to use the system's urllib3 | ||
4218 | 86 | + # library instead of the embedded one. setup.py imports requests.compat | ||
4219 | 87 | + # to get the is_py2 variable. However, if you're building the source | ||
4220 | 88 | + # package on a system with an older urllib3 that doesn't have the | ||
4221 | 89 | + # following import, setup.py will fail, and thus you cannot build the | ||
4222 | 90 | + # source package. In that case (and hopefully in no others, since the | ||
4223 | 91 | + # binary package Depends on python*-urllib3) grab the one from the | ||
4224 | 92 | + # embedded package. | ||
4225 | 93 | + try: | ||
4226 | 94 | + from urllib3.packages.ordered_dict import OrderedDict | ||
4227 | 95 | + except ImportError: | ||
4228 | 96 | + from .packages.urllib3.packages.ordered_dict import OrderedDict | ||
4229 | 97 | + | ||
4230 | 98 | |||
4231 | 99 | builtin_str = str | ||
4232 | 100 | bytes = str | ||
4233 | 101 | @@ -109,7 +121,7 @@ | ||
4234 | 102 | from http import cookiejar as cookielib | ||
4235 | 103 | from http.cookies import Morsel | ||
4236 | 104 | from io import StringIO | ||
4237 | 105 | - from .packages import chardet2 as chardet | ||
4238 | 106 | + import chardet | ||
4239 | 107 | from collections import OrderedDict | ||
4240 | 108 | |||
4241 | 109 | builtin_str = str | ||
4242 | 110 | --- a/requests/packages/__init__.py | ||
4243 | 111 | +++ b/requests/packages/__init__.py | ||
4244 | 112 | @@ -1,3 +1,3 @@ | ||
4245 | 113 | from __future__ import absolute_import | ||
4246 | 114 | |||
4247 | 115 | -from . import urllib3 | ||
4248 | 116 | +import urllib3 | ||
4249 | 117 | --- a/requests/safe_mode.py | ||
4250 | 118 | +++ b/requests/safe_mode.py | ||
4251 | 119 | @@ -12,7 +12,7 @@ | ||
4252 | 120 | """ | ||
4253 | 121 | |||
4254 | 122 | from .models import Response | ||
4255 | 123 | -from .packages.urllib3.response import HTTPResponse | ||
4256 | 124 | +from urllib3.response import HTTPResponse | ||
4257 | 125 | from .exceptions import RequestException, ConnectionError, HTTPError | ||
4258 | 126 | import socket | ||
4259 | 127 | |||
4260 | 0 | 128 | ||
4261 | === added file 'debian/patches/series' | |||
4262 | --- debian/patches/series 1970-01-01 00:00:00 +0000 | |||
4263 | +++ debian/patches/series 2013-01-28 21:06:46 +0000 | |||
4264 | @@ -0,0 +1,2 @@ | |||
4265 | 1 | 02_do-not-use-embedded-python-six.patch | ||
4266 | 2 | 03-use-distro-packages.patch | ||
4267 | 0 | 3 | ||
4268 | === modified file 'debian/rules' | |||
4269 | --- debian/rules 2011-06-06 02:11:15 +0000 | |||
4270 | +++ debian/rules 2013-01-28 21:06:46 +0000 | |||
4271 | @@ -1,7 +1,29 @@ | |||
4272 | 1 | #!/usr/bin/make -f | 1 | #!/usr/bin/make -f |
4273 | 2 | 2 | ||
4274 | 3 | PYVERS := $(shell pyversions -r) | ||
4275 | 4 | |||
4276 | 3 | %: | 5 | %: |
4277 | 4 | dh $@ --with python2 --buildsystem=python_distutils | 6 | dh $@ --with python2 --buildsystem=python_distutils |
4278 | 5 | 7 | ||
4279 | 8 | override_dh_auto_build: | ||
4280 | 9 | set -ex; \ | ||
4281 | 10 | for python in $(PYVERS); do \ | ||
4282 | 11 | $$python setup.py build; \ | ||
4283 | 12 | done | ||
4284 | 13 | |||
4285 | 14 | override_dh_auto_clean: | ||
4286 | 15 | rm -rf build | ||
4287 | 16 | dh_auto_clean | ||
4288 | 17 | |||
4289 | 18 | override_dh_auto_configure: | ||
4290 | 19 | rm -rf requests/packages/urllib3 | ||
4291 | 20 | |||
4292 | 21 | override_dh_auto_install: | ||
4293 | 22 | set -ex; \ | ||
4294 | 23 | for python in $(PYVERS); do \ | ||
4295 | 24 | $$python setup.py install --skip-build --root debian/python-requests \ | ||
4296 | 25 | --install-layout deb; \ | ||
4297 | 26 | done | ||
4298 | 27 | |||
4299 | 6 | override_dh_installchangelogs: | 28 | override_dh_installchangelogs: |
4301 | 7 | dh_installchangelogs HISTORY.rst upstream | 29 | dh_installchangelogs HISTORY.rst |
4302 | 8 | 30 | ||
4303 | === modified file 'requests.egg-info/PKG-INFO' | |||
4304 | --- requests.egg-info/PKG-INFO 2011-11-25 00:02:28 +0000 | |||
4305 | +++ requests.egg-info/PKG-INFO 2013-01-28 21:06:46 +0000 | |||
4306 | @@ -1,14 +1,30 @@ | |||
4308 | 1 | Metadata-Version: 1.0 | 1 | Metadata-Version: 1.1 |
4309 | 2 | Name: requests | 2 | Name: requests |
4311 | 3 | Version: 0.8.2 | 3 | Version: 0.14.2 |
4312 | 4 | Summary: Python HTTP for Humans. | 4 | Summary: Python HTTP for Humans. |
4313 | 5 | Home-page: http://python-requests.org | 5 | Home-page: http://python-requests.org |
4314 | 6 | Author: Kenneth Reitz | 6 | Author: Kenneth Reitz |
4315 | 7 | Author-email: me@kennethreitz.com | 7 | Author-email: me@kennethreitz.com |
4317 | 8 | License: ISC | 8 | License: Copyright (c) 2012 Kenneth Reitz. |
4318 | 9 | |||
4319 | 10 | Permission to use, copy, modify, and/or distribute this software for any | ||
4320 | 11 | purpose with or without fee is hereby granted, provided that the above | ||
4321 | 12 | copyright notice and this permission notice appear in all copies. | ||
4322 | 13 | |||
4323 | 14 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
4324 | 15 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
4325 | 16 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
4326 | 17 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
4327 | 18 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
4328 | 19 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
4329 | 20 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
4330 | 9 | Description: Requests: HTTP for Humans | 21 | Description: Requests: HTTP for Humans |
4331 | 10 | ========================= | 22 | ========================= |
4332 | 11 | 23 | ||
4333 | 24 | |||
4334 | 25 | .. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop | ||
4335 | 26 | :target: https://secure.travis-ci.org/kennethreitz/requests | ||
4336 | 27 | |||
4337 | 12 | Requests is an ISC Licensed HTTP library, written in Python, for human | 28 | Requests is an ISC Licensed HTTP library, written in Python, for human |
4338 | 13 | beings. | 29 | beings. |
4339 | 14 | 30 | ||
4340 | @@ -27,60 +43,32 @@ | |||
4341 | 27 | 204 | 43 | 204 |
4342 | 28 | >>> r.headers['content-type'] | 44 | >>> r.headers['content-type'] |
4343 | 29 | 'application/json' | 45 | 'application/json' |
4345 | 30 | >>> r.content | 46 | >>> r.text |
4346 | 31 | ... | 47 | ... |
4347 | 32 | 48 | ||
4348 | 33 | See `the same code, without Requests <https://gist.github.com/973705>`_. | 49 | See `the same code, without Requests <https://gist.github.com/973705>`_. |
4349 | 34 | 50 | ||
4352 | 35 | Requests allow you to send **HEAD**, **GET**, **POST**, **PUT**, | 51 | Requests allow you to send HTTP/1.1 requests. You can add headers, form data, |
4351 | 36 | **PATCH**, and **DELETE** HTTP requests. You can add headers, form data, | ||
4353 | 37 | multipart files, and parameters with simple Python dictionaries, and access the | 52 | multipart files, and parameters with simple Python dictionaries, and access the |
4356 | 38 | response data in the same way. It's powered by httplib, but it does | 53 | response data in the same way. It's powered by httplib and `urllib3 |
4357 | 39 | all the hard work and crazy hacks for you. | 54 | <https://github.com/shazow/urllib3>`_, but it does all the hard work and crazy |
4358 | 55 | hacks for you. | ||
4359 | 40 | 56 | ||
4360 | 41 | 57 | ||
4361 | 42 | Features | 58 | Features |
4362 | 43 | -------- | 59 | -------- |
4363 | 44 | 60 | ||
4403 | 45 | - Extremely simple HEAD, GET, POST, PUT, PATCH, DELETE Requests. | 61 | - International Domains and URLs |
4404 | 46 | - Gevent support for Asyncronous Requests. | 62 | - Keep-Alive & Connection Pooling |
4405 | 47 | - Sessions with cookie persistience. | 63 | - Sessions with Cookie Persistence |
4406 | 48 | - Basic, Digest, and Custom Authentication support. | 64 | - Browser-style SSL Verification |
4407 | 49 | - Automatic form-encoding of dictionaries | 65 | - Basic/Digest Authentication |
4408 | 50 | - A simple dictionary interface for request/response cookies. | 66 | - Elegant Key/Value Cookies |
4409 | 51 | - Multipart file uploads. | 67 | - Automatic Decompression |
4410 | 52 | - Automatc decoding of Unicode, gzip, and deflate responses. | 68 | - Unicode Response Bodies |
4411 | 53 | - Full support for unicode URLs and domain names. | 69 | - Multipart File Uploads |
4412 | 54 | 70 | - Connection Timeouts | |
4413 | 55 | 71 | - Thread-safety | |
4375 | 56 | Usage | ||
4376 | 57 | ----- | ||
4377 | 58 | |||
4378 | 59 | It couldn't be simpler. :: | ||
4379 | 60 | |||
4380 | 61 | >>> import requests | ||
4381 | 62 | >>> r = requests.get('http://google.com') | ||
4382 | 63 | |||
4383 | 64 | |||
4384 | 65 | HTTPS? Basic Authentication? :: | ||
4385 | 66 | |||
4386 | 67 | >>> r = requests.get('https://httpbin.ep.io/basic-auth/user/pass') | ||
4387 | 68 | >>> r.status_code | ||
4388 | 69 | 401 | ||
4389 | 70 | |||
4390 | 71 | |||
4391 | 72 | Uh oh, we're not authorized! Let's add authentication. :: | ||
4392 | 73 | |||
4393 | 74 | >>> r = requests.get('https://httpbin.ep.io/basic-auth/user/pass', auth=('user', 'pass')) | ||
4394 | 75 | |||
4395 | 76 | >>> r.status_code | ||
4396 | 77 | 200 | ||
4397 | 78 | |||
4398 | 79 | >>> r.headers['content-type'] | ||
4399 | 80 | 'application/json' | ||
4400 | 81 | |||
4401 | 82 | >>> r.content | ||
4402 | 83 | '{"authenticated": true, "user": "user"}' | ||
4414 | 84 | 72 | ||
4415 | 85 | 73 | ||
4416 | 86 | Installation | 74 | Installation |
4417 | @@ -107,16 +95,312 @@ | |||
4418 | 107 | #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. | 95 | #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_. |
4419 | 108 | 96 | ||
4420 | 109 | .. _`the repository`: http://github.com/kennethreitz/requests | 97 | .. _`the repository`: http://github.com/kennethreitz/requests |
4423 | 110 | .. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORS | 98 | .. _AUTHORS: https://github.com/kennethreitz/requests/blob/develop/AUTHORS.rst |
4424 | 111 | 99 | ||
4425 | 100 | |||
4426 | 101 | .. :changelog: | ||
4427 | 112 | 102 | ||
4428 | 113 | History | 103 | History |
4429 | 114 | ------- | 104 | ------- |
4430 | 115 | 105 | ||
4431 | 106 | 0.14.2 (2012-10-27) | ||
4432 | 107 | +++++++++++++++++++ | ||
4433 | 108 | |||
4434 | 109 | - Improved mime-compatible JSON handling | ||
4435 | 110 | - Proxy fixes | ||
4436 | 111 | - Path hack fixes | ||
4437 | 112 | - Case-Insensistive Content-Encoding headers | ||
4438 | 113 | - Support for CJK parameters in form posts | ||
4439 | 114 | |||
4440 | 115 | |||
4441 | 116 | 0.14.1 (2012-10-01) | ||
4442 | 117 | +++++++++++++++++++ | ||
4443 | 118 | |||
4444 | 119 | - Python 3.3 Compatibility | ||
4445 | 120 | - Simply default accept-encoding | ||
4446 | 121 | - Bugfixes | ||
4447 | 122 | |||
4448 | 123 | |||
4449 | 124 | 0.14.0 (2012-09-02) | ||
4450 | 125 | ++++++++++++++++++++ | ||
4451 | 126 | |||
4452 | 127 | - No more iter_content errors if already downloaded. | ||
4453 | 128 | |||
4454 | 129 | 0.13.9 (2012-08-25) | ||
4455 | 130 | +++++++++++++++++++ | ||
4456 | 131 | |||
4457 | 132 | - Fix for OAuth + POSTs | ||
4458 | 133 | - Remove exception eating from dispatch_hook | ||
4459 | 134 | - General bugfixes | ||
4460 | 135 | |||
4461 | 136 | 0.13.8 (2012-08-21) | ||
4462 | 137 | +++++++++++++++++++ | ||
4463 | 138 | |||
4464 | 139 | - Incredible Link header support :) | ||
4465 | 140 | |||
4466 | 141 | 0.13.7 (2012-08-19) | ||
4467 | 142 | +++++++++++++++++++ | ||
4468 | 143 | |||
4469 | 144 | - Support for (key, value) lists everywhere. | ||
4470 | 145 | - Digest Authentication improvements. | ||
4471 | 146 | - Ensure proxy exclusions work properly. | ||
4472 | 147 | - Clearer UnicodeError exceptions. | ||
4473 | 148 | - Automatic casting of URLs to tsrings (fURL and such) | ||
4474 | 149 | - Bugfixes. | ||
4475 | 150 | |||
4476 | 151 | 0.13.6 (2012-08-06) | ||
4477 | 152 | +++++++++++++++++++ | ||
4478 | 153 | |||
4479 | 154 | - Long awaited fix for hanging connections! | ||
4480 | 155 | |||
4481 | 156 | 0.13.5 (2012-07-27) | ||
4482 | 157 | +++++++++++++++++++ | ||
4483 | 158 | |||
4484 | 159 | - Packaging fix | ||
4485 | 160 | |||
4486 | 161 | 0.13.4 (2012-07-27) | ||
4487 | 162 | +++++++++++++++++++ | ||
4488 | 163 | |||
4489 | 164 | - GSSAPI/Kerberos authentication! | ||
4490 | 165 | - App Engine 2.7 Fixes! | ||
4491 | 166 | - Fix leaking connections (from urllib3 update) | ||
4492 | 167 | - OAuthlib path hack fix | ||
4493 | 168 | - OAuthlib URL parameters fix. | ||
4494 | 169 | |||
4495 | 170 | 0.13.3 (2012-07-12) | ||
4496 | 171 | +++++++++++++++++++ | ||
4497 | 172 | |||
4498 | 173 | - Use simplejson if available. | ||
4499 | 174 | - Do not hide SSLErrors behind Timeouts. | ||
4500 | 175 | - Fixed param handling with urls containing fragments. | ||
4501 | 176 | - Significantly improved information in User Agent. | ||
4502 | 177 | - client certificates are ignored when verify=False | ||
4503 | 178 | |||
4504 | 179 | 0.13.2 (2012-06-28) | ||
4505 | 180 | +++++++++++++++++++ | ||
4506 | 181 | |||
4507 | 182 | - Zero dependencies (once again)! | ||
4508 | 183 | - New: Response.reason | ||
4509 | 184 | - Sign querystring parameters in OAuth 1.0 | ||
4510 | 185 | - Client certificates no longer ignored when verify=False | ||
4511 | 186 | - Add openSUSE certificate support | ||
4512 | 187 | |||
4513 | 188 | 0.13.1 (2012-06-07) | ||
4514 | 189 | +++++++++++++++++++ | ||
4515 | 190 | |||
4516 | 191 | - Allow passing a file or file-like object as data. | ||
4517 | 192 | - Allow hooks to return responses that indicate errors. | ||
4518 | 193 | - Fix Response.text and Response.json for body-less responses. | ||
4519 | 194 | |||
4520 | 195 | 0.13.0 (2012-05-29) | ||
4521 | 196 | +++++++++++++++++++ | ||
4522 | 197 | |||
4523 | 198 | - Removal of Requests.async in favor of `grequests <https://github.com/kennethreitz/grequests>`_ | ||
4524 | 199 | - Allow disabling of cookie persistiance. | ||
4525 | 200 | - New implimentation of safe_mode | ||
4526 | 201 | - cookies.get now supports default argument | ||
4527 | 202 | - Session cookies not saved when Session.request is called with return_response=False | ||
4528 | 203 | - Env: no_proxy support. | ||
4529 | 204 | - RequestsCookieJar improvements. | ||
4530 | 205 | - Various bug fixes. | ||
4531 | 206 | |||
4532 | 207 | 0.12.1 (2012-05-08) | ||
4533 | 208 | +++++++++++++++++++ | ||
4534 | 209 | |||
4535 | 210 | - New ``Response.json`` property. | ||
4536 | 211 | - Ability to add string file uploads. | ||
4537 | 212 | - Fix out-of-range issue with iter_lines. | ||
4538 | 213 | - Fix iter_content default size. | ||
4539 | 214 | - Fix POST redirects containing files. | ||
4540 | 215 | |||
4541 | 216 | 0.12.0 (2012-05-02) | ||
4542 | 217 | +++++++++++++++++++ | ||
4543 | 218 | |||
4544 | 219 | - EXPERIMENTAL OAUTH SUPPORT! | ||
4545 | 220 | - Proper CookieJar-backed cookies interface with awesome dict-like interface. | ||
4546 | 221 | - Speed fix for non-iterated content chunks. | ||
4547 | 222 | - Move ``pre_request`` to a more usable place. | ||
4548 | 223 | - New ``pre_send`` hook. | ||
4549 | 224 | - Lazily encode data, params, files. | ||
4550 | 225 | - Load system Certificate Bundle if ``certify`` isn't available. | ||
4551 | 226 | - Cleanups, fixes. | ||
4552 | 227 | |||
4553 | 228 | 0.11.2 (2012-04-22) | ||
4554 | 229 | +++++++++++++++++++ | ||
4555 | 230 | |||
4556 | 231 | - Attempt to use the OS's certificate bundle if ``certifi`` isn't available. | ||
4557 | 232 | - Infinite digest auth redirect fix. | ||
4558 | 233 | - Multi-part file upload improvements. | ||
4559 | 234 | - Fix decoding of invalid %encodings in URLs. | ||
4560 | 235 | - If there is no content in a response don't throw an error the second time that content is attempted to be read. | ||
4561 | 236 | - Upload data on redirects. | ||
4562 | 237 | |||
4563 | 238 | 0.11.1 (2012-03-30) | ||
4564 | 239 | +++++++++++++++++++ | ||
4565 | 240 | |||
4566 | 241 | * POST redirects now break RFC to do what browsers do: Follow up with a GET. | ||
4567 | 242 | * New ``strict_mode`` configuration to disable new redirect behavior. | ||
4568 | 243 | |||
4569 | 244 | |||
4570 | 245 | 0.11.0 (2012-03-14) | ||
4571 | 246 | +++++++++++++++++++ | ||
4572 | 247 | |||
4573 | 248 | * Private SSL Certificate support | ||
4574 | 249 | * Remove select.poll from Gevent monkeypatching | ||
4575 | 250 | * Remove redundant generator for chunked transfer encoding | ||
4576 | 251 | * Fix: Response.ok raises Timeout Exception in safe_mode | ||
4577 | 252 | |||
4578 | 253 | 0.10.8 (2012-03-09) | ||
4579 | 254 | +++++++++++++++++++ | ||
4580 | 255 | |||
4581 | 256 | * Generate chunked ValueError fix | ||
4582 | 257 | * Proxy configuration by environment variables | ||
4583 | 258 | * Simplification of iter_lines. | ||
4584 | 259 | * New `trust_env` configuration for disabling system/environment hints. | ||
4585 | 260 | * Suppress cookie errors. | ||
4586 | 261 | |||
4587 | 262 | 0.10.7 (2012-03-07) | ||
4588 | 263 | +++++++++++++++++++ | ||
4589 | 264 | |||
4590 | 265 | * `encode_uri` = False | ||
4591 | 266 | |||
4592 | 267 | 0.10.6 (2012-02-25) | ||
4593 | 268 | +++++++++++++++++++ | ||
4594 | 269 | |||
4595 | 270 | * Allow '=' in cookies. | ||
4596 | 271 | |||
4597 | 272 | 0.10.5 (2012-02-25) | ||
4598 | 273 | +++++++++++++++++++ | ||
4599 | 274 | |||
4600 | 275 | * Response body with 0 content-length fix. | ||
4601 | 276 | * New async.imap. | ||
4602 | 277 | * Don't fail on netrc. | ||
4603 | 278 | |||
4604 | 279 | |||
4605 | 280 | 0.10.4 (2012-02-20) | ||
4606 | 281 | +++++++++++++++++++ | ||
4607 | 282 | |||
4608 | 283 | * Honor netrc. | ||
4609 | 284 | |||
4610 | 285 | 0.10.3 (2012-02-20) | ||
4611 | 286 | +++++++++++++++++++ | ||
4612 | 287 | |||
4613 | 288 | * HEAD requests don't follow redirects anymore. | ||
4614 | 289 | * raise_for_status() doesn't raise for 3xx anymore. | ||
4615 | 290 | * Make Session objects picklable. | ||
4616 | 291 | * ValueError for invalid schema URLs. | ||
4617 | 292 | |||
4618 | 293 | 0.10.2 (2012-01-15) | ||
4619 | 294 | +++++++++++++++++++ | ||
4620 | 295 | |||
4621 | 296 | * Vastly improved URL quoting. | ||
4622 | 297 | * Additional allowed cookie key values. | ||
4623 | 298 | * Attempted fix for "Too many open files" Error | ||
4624 | 299 | * Replace unicode errors on first pass, no need for second pass. | ||
4625 | 300 | * Append '/' to bare-domain urls before query insertion. | ||
4626 | 301 | * Exceptions now inherit from RuntimeError. | ||
4627 | 302 | * Binary uploads + auth fix. | ||
4628 | 303 | * Bugfixes. | ||
4629 | 304 | |||
4630 | 305 | |||
4631 | 306 | 0.10.1 (2012-01-23) | ||
4632 | 307 | +++++++++++++++++++ | ||
4633 | 308 | |||
4634 | 309 | * PYTHON 3 SUPPORT! | ||
4635 | 310 | * Dropped 2.5 Support. (*Backwards Incompatible*) | ||
4636 | 311 | |||
4637 | 312 | 0.10.0 (2012-01-21) | ||
4638 | 313 | +++++++++++++++++++ | ||
4639 | 314 | |||
4640 | 315 | * ``Response.content`` is now bytes-only. (*Backwards Incompatible*) | ||
4641 | 316 | * New ``Response.text`` is unicode-only. | ||
4642 | 317 | * If no ``Response.encoding`` is specified and ``chardet`` is available, ``Respoonse.text`` will guess an encoding. | ||
4643 | 318 | * Default to ISO-8859-1 (Western) encoding for "text" subtypes. | ||
4644 | 319 | * Removal of `decode_unicode`. (*Backwards Incompatible*) | ||
4645 | 320 | * New multiple-hooks system. | ||
4646 | 321 | * New ``Response.register_hook`` for registering hooks within the pipeline. | ||
4647 | 322 | * ``Response.url`` is now Unicode. | ||
4648 | 323 | |||
4649 | 324 | 0.9.3 (2012-01-18) | ||
4650 | 325 | ++++++++++++++++++ | ||
4651 | 326 | |||
4652 | 327 | * SSL verify=False bugfix (apparent on windows machines). | ||
4653 | 328 | |||
4654 | 329 | 0.9.2 (2012-01-18) | ||
4655 | 330 | ++++++++++++++++++ | ||
4656 | 331 | |||
4657 | 332 | * Asynchronous async.send method. | ||
4658 | 333 | * Support for proper chunk streams with boundaries. | ||
4659 | 334 | * session argument for Session classes. | ||
4660 | 335 | * Print entire hook tracebacks, not just exception instance. | ||
4661 | 336 | * Fix response.iter_lines from pending next line. | ||
4662 | 337 | * Fix but in HTTP-digest auth w/ URI having query strings. | ||
4663 | 338 | * Fix in Event Hooks section. | ||
4664 | 339 | * Urllib3 update. | ||
4665 | 340 | |||
4666 | 341 | |||
4667 | 342 | 0.9.1 (2012-01-06) | ||
4668 | 343 | ++++++++++++++++++ | ||
4669 | 344 | |||
4670 | 345 | * danger_mode for automatic Response.raise_for_status() | ||
4671 | 346 | * Response.iter_lines refactor | ||
4672 | 347 | |||
4673 | 348 | 0.9.0 (2011-12-28) | ||
4674 | 349 | ++++++++++++++++++ | ||
4675 | 350 | |||
4676 | 351 | * verify ssl is default. | ||
4677 | 352 | |||
4678 | 353 | |||
4679 | 354 | 0.8.9 (2011-12-28) | ||
4680 | 355 | ++++++++++++++++++ | ||
4681 | 356 | |||
4682 | 357 | * Packaging fix. | ||
4683 | 358 | |||
4684 | 359 | |||
4685 | 360 | 0.8.8 (2011-12-28) | ||
4686 | 361 | ++++++++++++++++++ | ||
4687 | 362 | |||
4688 | 363 | * SSL CERT VERIFICATION! | ||
4689 | 364 | * Release of Cerifi: Mozilla's cert list. | ||
4690 | 365 | * New 'verify' argument for SSL requests. | ||
4691 | 366 | * Urllib3 update. | ||
4692 | 367 | |||
4693 | 368 | 0.8.7 (2011-12-24) | ||
4694 | 369 | ++++++++++++++++++ | ||
4695 | 370 | |||
4696 | 371 | * iter_lines last-line truncation fix | ||
4697 | 372 | * Force safe_mode for async requests | ||
4698 | 373 | * Handle safe_mode exceptions more consistently | ||
4699 | 374 | * Fix iteration on null responses in safe_mode | ||
4700 | 375 | |||
4701 | 376 | 0.8.6 (2011-12-18) | ||
4702 | 377 | ++++++++++++++++++ | ||
4703 | 378 | |||
4704 | 379 | * Socket timeout fixes. | ||
4705 | 380 | * Proxy Authorization support. | ||
4706 | 381 | |||
4707 | 382 | 0.8.5 (2011-12-14) | ||
4708 | 383 | ++++++++++++++++++ | ||
4709 | 384 | |||
4710 | 385 | * Response.iter_lines! | ||
4711 | 386 | |||
4712 | 387 | 0.8.4 (2011-12-11) | ||
4713 | 388 | ++++++++++++++++++ | ||
4714 | 389 | |||
4715 | 390 | * Prefetch bugfix. | ||
4716 | 391 | * Added license to installed version. | ||
4717 | 392 | |||
4718 | 393 | 0.8.3 (2011-11-27) | ||
4719 | 394 | ++++++++++++++++++ | ||
4720 | 395 | |||
4721 | 396 | * Converted auth system to use simpler callable objects. | ||
4722 | 397 | * New session parameter to API methods. | ||
4723 | 398 | * Display full URL while logging. | ||
4724 | 399 | |||
4725 | 116 | 0.8.2 (2011-11-19) | 400 | 0.8.2 (2011-11-19) |
4726 | 117 | ++++++++++++++++++ | 401 | ++++++++++++++++++ |
4727 | 118 | 402 | ||
4729 | 119 | * New unicode decoding system, based on overridable `Response.encoding`. | 403 | * New Unicode decoding system, based on over-ridable `Response.encoding`. |
4730 | 120 | * Proper URL slash-quote handling. | 404 | * Proper URL slash-quote handling. |
4731 | 121 | * Cookies with ``[``, ``]``, and ``_`` allowed. | 405 | * Cookies with ``[``, ``]``, and ``_`` allowed. |
4732 | 122 | 406 | ||
4733 | @@ -140,6 +424,7 @@ | |||
4734 | 140 | * OPTION method | 424 | * OPTION method |
4735 | 141 | * Async pool size throttling | 425 | * Async pool size throttling |
4736 | 142 | * File uploads send real names | 426 | * File uploads send real names |
4737 | 427 | * Vendored in urllib3 | ||
4738 | 143 | 428 | ||
4739 | 144 | 0.7.6 (2011-11-07) | 429 | 0.7.6 (2011-11-07) |
4740 | 145 | ++++++++++++++++++ | 430 | ++++++++++++++++++ |
4741 | @@ -155,7 +440,7 @@ | |||
4742 | 155 | 0.7.4 (2011-10-26) | 440 | 0.7.4 (2011-10-26) |
4743 | 156 | ++++++++++++++++++ | 441 | ++++++++++++++++++ |
4744 | 157 | 442 | ||
4746 | 158 | * Sesion Hooks fix. | 443 | * Session Hooks fix. |
4747 | 159 | 444 | ||
4748 | 160 | 0.7.3 (2011-10-23) | 445 | 0.7.3 (2011-10-23) |
4749 | 161 | ++++++++++++++++++ | 446 | ++++++++++++++++++ |
4750 | @@ -386,6 +671,10 @@ | |||
4751 | 386 | Classifier: Natural Language :: English | 671 | Classifier: Natural Language :: English |
4752 | 387 | Classifier: License :: OSI Approved :: ISC License (ISCL) | 672 | Classifier: License :: OSI Approved :: ISC License (ISCL) |
4753 | 388 | Classifier: Programming Language :: Python | 673 | Classifier: Programming Language :: Python |
4754 | 389 | Classifier: Programming Language :: Python :: 2.5 | ||
4755 | 390 | Classifier: Programming Language :: Python :: 2.6 | 674 | Classifier: Programming Language :: Python :: 2.6 |
4756 | 391 | Classifier: Programming Language :: Python :: 2.7 | 675 | Classifier: Programming Language :: Python :: 2.7 |
4757 | 676 | Classifier: Programming Language :: Python :: 3 | ||
4758 | 677 | Classifier: Programming Language :: Python :: 3.0 | ||
4759 | 678 | Classifier: Programming Language :: Python :: 3.1 | ||
4760 | 679 | Classifier: Programming Language :: Python :: 3.2 | ||
4761 | 680 | Classifier: Programming Language :: Python :: 3.3 | ||
4762 | 392 | 681 | ||
4763 | === modified file 'requests.egg-info/SOURCES.txt' | |||
4764 | --- requests.egg-info/SOURCES.txt 2011-11-25 00:02:28 +0000 | |||
4765 | +++ requests.egg-info/SOURCES.txt 2013-01-28 21:06:46 +0000 | |||
4766 | @@ -1,17 +1,24 @@ | |||
4767 | 1 | HISTORY.rst | 1 | HISTORY.rst |
4768 | 2 | LICENSE | 2 | LICENSE |
4769 | 3 | MANIFEST.in | 3 | MANIFEST.in |
4770 | 4 | NOTICE | ||
4771 | 4 | README.rst | 5 | README.rst |
4772 | 5 | setup.py | 6 | setup.py |
4773 | 6 | test_requests.py | ||
4774 | 7 | requests/__init__.py | 7 | requests/__init__.py |
4775 | 8 | requests/_oauth.py | ||
4776 | 9 | requests/adapters.py | ||
4777 | 8 | requests/api.py | 10 | requests/api.py |
4778 | 9 | requests/async.py | 11 | requests/async.py |
4779 | 10 | requests/auth.py | 12 | requests/auth.py |
4780 | 13 | requests/cacert.pem | ||
4781 | 14 | requests/certs.py | ||
4782 | 15 | requests/compat.py | ||
4783 | 16 | requests/cookies.py | ||
4784 | 11 | requests/defaults.py | 17 | requests/defaults.py |
4785 | 12 | requests/exceptions.py | 18 | requests/exceptions.py |
4786 | 13 | requests/hooks.py | 19 | requests/hooks.py |
4787 | 14 | requests/models.py | 20 | requests/models.py |
4788 | 21 | requests/safe_mode.py | ||
4789 | 15 | requests/sessions.py | 22 | requests/sessions.py |
4790 | 16 | requests/status_codes.py | 23 | requests/status_codes.py |
4791 | 17 | requests/structures.py | 24 | requests/structures.py |
4792 | @@ -21,10 +28,53 @@ | |||
4793 | 21 | requests.egg-info/dependency_links.txt | 28 | requests.egg-info/dependency_links.txt |
4794 | 22 | requests.egg-info/top_level.txt | 29 | requests.egg-info/top_level.txt |
4795 | 23 | requests/packages/__init__.py | 30 | requests/packages/__init__.py |
4800 | 24 | requests/packages/oreos/__init__.py | 31 | requests/packages/chardet/__init__.py |
4801 | 25 | requests/packages/oreos/core.py | 32 | requests/packages/chardet/big5freq.py |
4802 | 26 | requests/packages/oreos/monkeys.py | 33 | requests/packages/chardet/big5prober.py |
4803 | 27 | requests/packages/oreos/structures.py | 34 | requests/packages/chardet/chardistribution.py |
4804 | 35 | requests/packages/chardet/charsetgroupprober.py | ||
4805 | 36 | requests/packages/chardet/charsetprober.py | ||
4806 | 37 | requests/packages/chardet/codingstatemachine.py | ||
4807 | 38 | requests/packages/chardet/constants.py | ||
4808 | 39 | requests/packages/chardet/escprober.py | ||
4809 | 40 | requests/packages/chardet/escsm.py | ||
4810 | 41 | requests/packages/chardet/eucjpprober.py | ||
4811 | 42 | requests/packages/chardet/euckrfreq.py | ||
4812 | 43 | requests/packages/chardet/euckrprober.py | ||
4813 | 44 | requests/packages/chardet/euctwfreq.py | ||
4814 | 45 | requests/packages/chardet/euctwprober.py | ||
4815 | 46 | requests/packages/chardet/gb2312freq.py | ||
4816 | 47 | requests/packages/chardet/gb2312prober.py | ||
4817 | 48 | requests/packages/chardet/hebrewprober.py | ||
4818 | 49 | requests/packages/chardet/jisfreq.py | ||
4819 | 50 | requests/packages/chardet/jpcntx.py | ||
4820 | 51 | requests/packages/chardet/langbulgarianmodel.py | ||
4821 | 52 | requests/packages/chardet/langcyrillicmodel.py | ||
4822 | 53 | requests/packages/chardet/langgreekmodel.py | ||
4823 | 54 | requests/packages/chardet/langhebrewmodel.py | ||
4824 | 55 | requests/packages/chardet/langhungarianmodel.py | ||
4825 | 56 | requests/packages/chardet/langthaimodel.py | ||
4826 | 57 | requests/packages/chardet/latin1prober.py | ||
4827 | 58 | requests/packages/chardet/mbcharsetprober.py | ||
4828 | 59 | requests/packages/chardet/mbcsgroupprober.py | ||
4829 | 60 | requests/packages/chardet/mbcssm.py | ||
4830 | 61 | requests/packages/chardet/sbcharsetprober.py | ||
4831 | 62 | requests/packages/chardet/sbcsgroupprober.py | ||
4832 | 63 | requests/packages/chardet/sjisprober.py | ||
4833 | 64 | requests/packages/chardet/universaldetector.py | ||
4834 | 65 | requests/packages/chardet/utf8prober.py | ||
4835 | 66 | requests/packages/oauthlib/__init__.py | ||
4836 | 67 | requests/packages/oauthlib/common.py | ||
4837 | 68 | requests/packages/oauthlib/oauth1/__init__.py | ||
4838 | 69 | requests/packages/oauthlib/oauth1/rfc5849/__init__.py | ||
4839 | 70 | requests/packages/oauthlib/oauth1/rfc5849/parameters.py | ||
4840 | 71 | requests/packages/oauthlib/oauth1/rfc5849/signature.py | ||
4841 | 72 | requests/packages/oauthlib/oauth1/rfc5849/utils.py | ||
4842 | 73 | requests/packages/oauthlib/oauth2/__init__.py | ||
4843 | 74 | requests/packages/oauthlib/oauth2/draft25/__init__.py | ||
4844 | 75 | requests/packages/oauthlib/oauth2/draft25/parameters.py | ||
4845 | 76 | requests/packages/oauthlib/oauth2/draft25/tokens.py | ||
4846 | 77 | requests/packages/oauthlib/oauth2/draft25/utils.py | ||
4847 | 28 | requests/packages/urllib3/__init__.py | 78 | requests/packages/urllib3/__init__.py |
4848 | 29 | requests/packages/urllib3/_collections.py | 79 | requests/packages/urllib3/_collections.py |
4849 | 30 | requests/packages/urllib3/connectionpool.py | 80 | requests/packages/urllib3/connectionpool.py |
4850 | @@ -32,4 +82,9 @@ | |||
4851 | 32 | requests/packages/urllib3/filepost.py | 82 | requests/packages/urllib3/filepost.py |
4852 | 33 | requests/packages/urllib3/poolmanager.py | 83 | requests/packages/urllib3/poolmanager.py |
4853 | 34 | requests/packages/urllib3/request.py | 84 | requests/packages/urllib3/request.py |
4854 | 35 | requests/packages/urllib3/response.py | ||
4855 | 36 | \ No newline at end of file | 85 | \ No newline at end of file |
4856 | 86 | requests/packages/urllib3/response.py | ||
4857 | 87 | requests/packages/urllib3/util.py | ||
4858 | 88 | requests/packages/urllib3/packages/__init__.py | ||
4859 | 89 | requests/packages/urllib3/packages/ordered_dict.py | ||
4860 | 90 | requests/packages/urllib3/packages/six.py | ||
4861 | 91 | requests/packages/urllib3/packages/ssl_match_hostname/__init__.py | ||
4862 | 37 | \ No newline at end of file | 92 | \ No newline at end of file |
4863 | 38 | 93 | ||
4864 | === modified file 'requests/__init__.py' | |||
4865 | --- requests/__init__.py 2011-11-25 00:02:28 +0000 | |||
4866 | +++ requests/__init__.py 2013-01-28 21:06:46 +0000 | |||
4867 | @@ -6,20 +6,47 @@ | |||
4868 | 6 | # / | 6 | # / |
4869 | 7 | 7 | ||
4870 | 8 | """ | 8 | """ |
4875 | 9 | requests | 9 | requests HTTP library |
4876 | 10 | ~~~~~~~~ | 10 | ~~~~~~~~~~~~~~~~~~~~~ |
4877 | 11 | 11 | ||
4878 | 12 | :copyright: (c) 2011 by Kenneth Reitz. | 12 | Requests is an HTTP library, written in Python, for human beings. Basic GET |
4879 | 13 | usage: | ||
4880 | 14 | |||
4881 | 15 | >>> import requests | ||
4882 | 16 | >>> r = requests.get('http://python.org') | ||
4883 | 17 | >>> r.status_code | ||
4884 | 18 | 200 | ||
4885 | 19 | >>> 'Python is a programming language' in r.content | ||
4886 | 20 | True | ||
4887 | 21 | |||
4888 | 22 | ... or POST: | ||
4889 | 23 | |||
4890 | 24 | >>> payload = dict(key1='value1', key2='value2') | ||
4891 | 25 | >>> r = requests.post("http://httpbin.org/post", data=payload) | ||
4892 | 26 | >>> print r.text | ||
4893 | 27 | { | ||
4894 | 28 | ... | ||
4895 | 29 | "form": { | ||
4896 | 30 | "key2": "value2", | ||
4897 | 31 | "key1": "value1" | ||
4898 | 32 | }, | ||
4899 | 33 | ... | ||
4900 | 34 | } | ||
4901 | 35 | |||
4902 | 36 | The other HTTP methods are supported - see `requests.api`. Full documentation | ||
4903 | 37 | is at <http://python-requests.org>. | ||
4904 | 38 | |||
4905 | 39 | :copyright: (c) 2012 by Kenneth Reitz. | ||
4906 | 13 | :license: ISC, see LICENSE for more details. | 40 | :license: ISC, see LICENSE for more details. |
4907 | 14 | 41 | ||
4908 | 15 | """ | 42 | """ |
4909 | 16 | 43 | ||
4910 | 17 | __title__ = 'requests' | 44 | __title__ = 'requests' |
4913 | 18 | __version__ = '0.8.2' | 45 | __version__ = '0.14.2' |
4914 | 19 | __build__ = 0x000802 | 46 | __build__ = 0x001402 |
4915 | 20 | __author__ = 'Kenneth Reitz' | 47 | __author__ = 'Kenneth Reitz' |
4916 | 21 | __license__ = 'ISC' | 48 | __license__ = 'ISC' |
4918 | 22 | __copyright__ = 'Copyright 2011 Kenneth Reitz' | 49 | __copyright__ = 'Copyright 2012 Kenneth Reitz' |
4919 | 23 | 50 | ||
4920 | 24 | 51 | ||
4921 | 25 | from . import utils | 52 | from . import utils |
4922 | 26 | 53 | ||
4923 | === added file 'requests/_oauth.py' | |||
4924 | --- requests/_oauth.py 1970-01-01 00:00:00 +0000 | |||
4925 | +++ requests/_oauth.py 2013-01-28 21:06:46 +0000 | |||
4926 | @@ -0,0 +1,23 @@ | |||
4927 | 1 | # -*- coding: utf-8 -*- | ||
4928 | 2 | |||
4929 | 3 | """ | ||
4930 | 4 | requests._oauth | ||
4931 | 5 | ~~~~~~~~~~~~~~~ | ||
4932 | 6 | |||
4933 | 7 | This module contains the path hack necessary for oauthlib to be vendored into | ||
4934 | 8 | requests while allowing upstream changes. | ||
4935 | 9 | """ | ||
4936 | 10 | |||
4937 | 11 | import os | ||
4938 | 12 | import sys | ||
4939 | 13 | |||
4940 | 14 | try: | ||
4941 | 15 | from oauthlib.oauth1 import rfc5849 | ||
4942 | 16 | from oauthlib.common import extract_params | ||
4943 | 17 | from oauthlib.oauth1.rfc5849 import (Client, SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER) | ||
4944 | 18 | except ImportError: | ||
4945 | 19 | from .packages import oauthlib | ||
4946 | 20 | sys.modules['oauthlib'] = oauthlib | ||
4947 | 21 | from oauthlib.oauth1 import rfc5849 | ||
4948 | 22 | from oauthlib.common import extract_params | ||
4949 | 23 | from oauthlib.oauth1.rfc5849 import (Client, SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER) | ||
4950 | 0 | 24 | ||
4951 | === added file 'requests/adapters.py' | |||
4952 | --- requests/adapters.py 1970-01-01 00:00:00 +0000 | |||
4953 | +++ requests/adapters.py 2013-01-28 21:06:46 +0000 | |||
4954 | @@ -0,0 +1,58 @@ | |||
4955 | 1 | # -*- coding: utf-8 -*- | ||
4956 | 2 | |||
4957 | 3 | """ | ||
4958 | 4 | requests.adapters | ||
4959 | 5 | ~~~~~~~~~~~~~~~~~ | ||
4960 | 6 | |||
4961 | 7 | This module contains the transport adapters that Requests uses to define | ||
4962 | 8 | and maintain connections. | ||
4963 | 9 | """ | ||
4964 | 10 | |||
4965 | 11 | from urllib3.poolmanager import PoolManager | ||
4966 | 12 | |||
4967 | 13 | class BaseAdapter(object): | ||
4968 | 14 | """The Base Transport Adapter""" | ||
4969 | 15 | |||
4970 | 16 | def __init__(self, config=None): | ||
4971 | 17 | super(BaseAdapter, self).__init__() | ||
4972 | 18 | self.config = config or {} | ||
4973 | 19 | self.session = None | ||
4974 | 20 | |||
4975 | 21 | @property | ||
4976 | 22 | def configure(self, config): | ||
4977 | 23 | self.config.update(config) | ||
4978 | 24 | |||
4979 | 25 | def send(self): | ||
4980 | 26 | raise NotImplementedError | ||
4981 | 27 | |||
4982 | 28 | def close(self): | ||
4983 | 29 | raise NotImplementedError | ||
4984 | 30 | |||
4985 | 31 | |||
4986 | 32 | class HTTPAdapter(BaseAdapter): | ||
4987 | 33 | """Built-In HTTP Adapter for Urllib3.""" | ||
4988 | 34 | def __init__(self): | ||
4989 | 35 | super(HTTPAdapter, self).__init__() | ||
4990 | 36 | |||
4991 | 37 | self.init_poolmanager() | ||
4992 | 38 | |||
4993 | 39 | def init_poolmanager(self): | ||
4994 | 40 | self.poolmanager = PoolManager( | ||
4995 | 41 | num_pools=self.config.get('pool_connections'), | ||
4996 | 42 | maxsize=self.config.get('pool_maxsize') | ||
4997 | 43 | ) | ||
4998 | 44 | |||
4999 | 45 | def close(self): | ||
5000 | 46 | """Dispose of any internal state. |