Merge lp:~zulcss/ubuntu/precise/requests/requests-ca into lp:ubuntu/precise/requests

Proposed by Chuck Short
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
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+145251@code.launchpad.net

This proposal supersedes a proposal from 2013-01-28.

To post a comment you must log in.

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

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

Subscribers

People subscribed via source and target branches

to all changes: