Skip to content
Myr

urllib3 update

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent fe68826 · Browse files · 6 files+43 added−26 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+43 added−26 removed

  • other:+43 added−26 removed

6 files+43 added−26 removed

modified:requests/packages/urllib3/contrib/ntlmpool.py+1 added-1 removed
11 unmodified lines
1213try:14 from http.client import HTTPSConnection15except ImportError:16 from http.client import HTTPSConnection16 from httplib import HTTPSConnection17from logging import getLogger18from ntlm import ntlm1920from urllib3 import HTTPSConnectionPool
100 unmodified lines
modified:requests/packages/urllib3/packages/__init__.py+1 added-1 removed
1from __future__ import absolute_import223from . import ssl_match_hostname4
modified:requests/packages/urllib3/packages/six.py+15 added-15 removed
37 unmodified lines
38 binary_type = bytes3940 MAXSIZE = sys.maxsize41else:42 string_types = str,43 integer_types = (int, int)44 class_types = (type, type)45 text_type = str42 string_types = basestring,43 integer_types = (int, long)44 class_types = (type, types.ClassType)45 text_type = unicode46 binary_type = str4748 # It's possible to have sizeof(long) != sizeof(Py_ssize_t).49 class X(object):
179 unmodified lines
229 def callable(obj):230 return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)231else:232 def get_unbound_function(unbound):233 return unbound.__func__233 return unbound.im_func234235236 def advance_iterator(it):237 return next(it)237 return it.next()238239 callable = callable240_add_doc(get_unbound_function,241 """Get the function out of a possibly unbound function""")
35 unmodified lines
277else:278 def b(s):279 return s280 def u(s):281 return str(s, "unicode_escape")281 return unicode(s, "unicode_escape")282 int2byte = chr283 import io284 StringIO = BytesIO = io.StringIO283 import StringIO284 StringIO = BytesIO = StringIO.StringIO285_add_doc(b, """Byte literal""")286_add_doc(u, """Text literal""")287288
35 unmodified lines
324 fp = kwargs.pop("file", sys.stdout)325 if fp is None:326 return327 def write(data):328 if not isinstance(data, str):328 if not isinstance(data, basestring):329 data = str(data)330 fp.write(data)331 want_unicode = False332 sep = kwargs.pop("sep", None)333 if sep is not None:334 if isinstance(sep, str):334 if isinstance(sep, unicode):335 want_unicode = True336 elif not isinstance(sep, str):337 raise TypeError("sep must be None or a string")338 end = kwargs.pop("end", None)339 if end is not None:340 if isinstance(end, str):340 if isinstance(end, unicode):341 want_unicode = True342 elif not isinstance(end, str):343 raise TypeError("end must be None or a string")344 if kwargs:345 raise TypeError("invalid keyword arguments to print()")346 if not want_unicode:347 for arg in args:348 if isinstance(arg, str):348 if isinstance(arg, unicode):349 want_unicode = True350 break351 if want_unicode:352 newline = str("\n")353 space = str(" ")352 newline = unicode("\n")353 space = unicode(" ")354 else:355 newline = "\n"356 space = " "357 if sep is None:
15 unmodified lines
modified:requests/packages/urllib3/connectionpool.py+18 added-6 removed
5 unmodified lines
67import logging8import socket910from select import poll, POLLIN10from httplib import (HTTPConnection, HTTPSConnection, HTTPException,11 HTTP_PORT, HTTPS_PORT)1213from Queue import Queue, Empty, Full14from socket import error as SocketError, timeout as SocketTimeout1516try:17 from select import poll, POLLIN18except ImportError: # Doesn't exist on OSX and other platforms19 from select import select20 poll = False2122try: # Python 323 from http.client import HTTPConnection, HTTPSConnection, HTTPException24 from http.client import HTTP_PORT, HTTPS_PORT25except ImportError:18 from http.client import HTTPConnection, HTTPSConnection, HTTPException19 from http.client import HTTP_PORT, HTTPS_PORT26 from httplib import HTTPConnection, HTTPSConnection, HTTPException27 from httplib import HTTP_PORT, HTTPS_PORT2829try: # Python 330 from queue import Queue, Empty, Full31except ImportError:24 from queue import Queue, Empty, Full32 from Queue import Queue, Empty, Full3334try: # Compiled with SSL?35 import ssl36 BaseSSLError = ssl.SSLError
1 unmodified line
38 ssl = None39 BaseSSLError = None404142from .packages.ssl_match_hostname import match_hostname, CertificateError43from .request import RequestMethods44from .response import HTTPResponse45from .exceptions import (SSLError,46 MaxRetryError,
121 unmodified lines
168 self.block = block169 self.headers = headers or {}170171 # Fill the queue up so that doing get() on it will block properly163 for _ in range(maxsize):172 for _ in xrange(maxsize):173 self.pool.put(None)174175 # These are mostly for testing and debugging purposes.176 self.num_connections = 0
418 unmodified lines
595596 :param conn:597 ``HTTPConnection`` object.598 """590 # poll-based replacement to select([conn.sock], [], [], 0.0)[0]:599 if not poll:600 return select([conn.sock], [], [], 0.0)[0]601602 # This version is better on platforms that support it.603 p = poll()604 p.register(conn.sock, POLLIN)605 for (fno, ev) in p.poll(0.0):606 if fno == conn.sock.fileno():
2 unmodified lines
modified:requests/packages/urllib3/request.py+1 added-1 removed
5 unmodified lines
67try:8 from urllib.parse import urlencode9except ImportError:10 from urllib.parse import urlencode10 from urllib import urlencode1112from .filepost import encode_multipart_formdata1314
133 unmodified lines
modified:requests/packages/urllib3/response.py+7 added-2 removed
8 unmodified lines
9import zlib1011from io import BytesIO121313from .exceptions import HTTPError141516try:17 basestring = basestring18except NameError: # Python 319 basestring = (str, bytes)202122log = logging.getLogger(__name__)232425def decode_gzip(data):
45 unmodified lines
71 self.reason = reason72 self.strict = strict7374 self._decode_content = decode_content70 self._body = body if body and isinstance(body, str) else None75 self._body = body if body and isinstance(body, basestring) else None76 self._fp = None77 self._original_response = original_response7879 self._pool = pool
117 unmodified lines