Merge remote-tracking branch 'upstream/master'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Conflicts: requests/sessions.py
authored by sprt · committed by sprt · parents a721d59, 0c09d16 · Browse files · 16 files·+131 added−115 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
16 files+131 added−115 removed
- other:+131 added−115 removed
Provenance
- Commit
c4ad8af- Tree
9f25d72- Author
sprt <hellosprt@gmail.com>- Committer
sprt <hellosprt@gmail.com>- Parent 1
a721d59- Parent 2
0c09d16
16 files changed+131 added−115 removed
modified:docs/user/advanced.rst+2 added-2 removed
142 unmodified lines143 144 Requests supports streaming uploads, which allow you to send large streams or files without reading them into memory. To stream and upload, simply provide a file-like object for your body::145 146 with open('massive-body') as f:147- request.post('http://some.url/streamed', data=f)147+ requests.post('http://some.url/streamed', data=f)148 149 150 Chunk-Encoded Requests151 ----------------------4 unmodified lines156 def gen():157 yield 'hi'158 yield 'there'159 160- request.post('http://some.url/chunked', data=gen())160+ requests.post('http://some.url/chunked', data=gen())161 162 163 Event Hooks164 -----------341 unmodified linesmodified:docs/user/quickstart.rst+3 added-3 removed
318 unmodified lines319 -------320 321 If a response contains some Cookies, you can get quick access to them::322 323- >>> url = 'http://httpbin.org/cookies/set/requests-is/awesome'323+ >>> url = 'http://example.com/some/cookie/setting/url'324 >>> r = requests.get(url)325 326- >>> r.cookies['requests-is']327- 'awesome'326+ >>> r.cookies['example_cookie_name']327+ 'example_cookie_value'328 329 To send your own cookies to the server, you can use the ``cookies``330 parameter::331 85 unmodified linesmodified:requests/packages/urllib3/connectionpool.py+11 added-15 removed
7 unmodified lines8 import socket9 import errno10 11 from socket import error as SocketError, timeout as SocketTimeout12+from .util import resolve_cert_reqs, resolve_ssl_version13 14 try: # Python 315 from http.client import HTTPConnection, HTTPException16 from http.client import HTTP_PORT, HTTPS_PORT63 unmodified lines80 ca_certs = None81 ssl_version = None82 83 def set_cert(self, key_file=None, cert_file=None,83- cert_reqs='CERT_NONE', ca_certs=None):84- ssl_req_scheme = {85- 'CERT_NONE': ssl.CERT_NONE,86- 'CERT_OPTIONAL': ssl.CERT_OPTIONAL,87- 'CERT_REQUIRED': ssl.CERT_REQUIRED88- }84+ cert_reqs=None, ca_certs=None):85 86 self.key_file = key_file87 self.cert_file = cert_file92- self.cert_reqs = ssl_req_scheme.get(cert_reqs) or ssl.CERT_NONE88+ self.cert_reqs = cert_reqs89 self.ca_certs = ca_certs90 91 def connect(self):92 # Add certificate verification93 sock = socket.create_connection((self.host, self.port), self.timeout)94 95+ resolved_cert_reqs = resolve_cert_reqs(self.cert_reqs)96+ resolved_ssl_version = resolve_ssl_version(self.ssl_version)97+98 # Wrap socket using verification with the root certs in99 # trusted_root_certs100 self.sock = ssl_wrap_socket(sock, self.key_file, self.cert_file,102- cert_reqs=self.cert_reqs,101+ cert_reqs=resolved_cert_reqs,102 ca_certs=self.ca_certs,103 server_hostname=self.host,105- ssl_version=self.ssl_version)104+ ssl_version=resolved_ssl_version)105 107- if self.ca_certs:106+ if resolved_cert_reqs != ssl.CERT_NONE:107 match_hostname(self.sock.getpeercert(), self.host)108 109 110 ## Pool objects401 unmodified lines512 def __init__(self, host, port=None,513 strict=False, timeout=None, maxsize=1,514 block=False, headers=None,515 key_file=None, cert_file=None,517- cert_reqs='CERT_NONE', ca_certs=None, ssl_version=None):516+ cert_reqs=None, ca_certs=None, ssl_version=None):517 518 HTTPConnectionPool.__init__(self, host, port,519 strict, timeout, maxsize,520 block, headers)25 unmodified lines546 strict=self.strict)547 connection.set_cert(key_file=self.key_file, cert_file=self.cert_file,548 cert_reqs=self.cert_reqs, ca_certs=self.ca_certs)549 551- if self.ssl_version is None:552- connection.ssl_version = ssl.PROTOCOL_SSLv23553- else:554- connection.ssl_version = self.ssl_version550+ connection.ssl_version = self.ssl_version551 552 return connection553 554 25 unmodified linesmodified:requests/packages/urllib3/poolmanager.py+13 added-4 removed
56 unmodified lines57 self.connection_pool_kw = connection_pool_kw58 self.pools = RecentlyUsedContainer(num_pools,59 dispose_func=lambda p: p.close())60 61+ def _new_pool(self, scheme, host, port):62+ """63+ Create a new :class:`ConnectionPool` based on host, port and scheme.64+65+ This method is used to actually create the connection pools handed out66+ by :meth:`connection_from_url` and companion methods. It is intended67+ to be overridden for customization.68+ """69+ pool_cls = pool_classes_by_scheme[scheme]70+ return pool_cls(host, port, **self.connection_pool_kw)71+72 def clear(self):73 """74 Empty our store of pools and direct them all to close.75 8 unmodified lines84 85 If ``port`` isn't given, it will be derived from the ``scheme`` using86 ``urllib3.connectionpool.port_by_scheme``.87 """88+ scheme = scheme or 'http'89 port = port or port_by_scheme.get(scheme, 80)90 91 pool_key = (scheme, host, port)92 3 unmodified lines96 if pool:97 return pool98 99 # Make a fresh ConnectionPool of the desired type88- pool_cls = pool_classes_by_scheme[scheme]89- pool = pool_cls(host, port, **self.connection_pool_kw)90-100+ pool = self._new_pool(scheme, host, port)101 self.pools[pool_key] = pool92-102 return pool103 104 def connection_from_url(self, url):105 """67 unmodified linesmodified:requests/packages/urllib3/response.py+11 added-1 removed
143 unmodified lines144 if amt is None:145 # cStringIO doesn't like amt=None146 data = self._fp.read()147 else:148- return self._fp.read(amt)148+ data = self._fp.read(amt)149+ if amt != 0 and not data: # Platform-specific: Buggy versions of Python.150+ # Close the connection when no data is returned151+ #152+ # This is redundant to what httplib/http.client _should_153+ # already do. However, versions of python released before154+ # December 15, 2012 (http://bugs.python.org/issue16298) do not155+ # properly close the connection in all cases. There is no harm156+ # in redundantly calling close.157+ self._fp.close()158+ return data159 160 try:161 if decode_content and decoder:162 data = decoder(data)52 unmodified linesmodified:requests/packages/urllib3/util.py+46 added-6 removed
20 unmodified lines21 try: # Test for SSL features22 SSLContext = None23 HAS_SNI = False24 25+ import ssl26 from ssl import wrap_socket, CERT_NONE, SSLError, PROTOCOL_SSLv2327 from ssl import SSLContext # Modern SSL?28 from ssl import HAS_SNI # Has SNI?29 except ImportError:233 unmodified lines263 # Either data is buffered (bad), or the connection is dropped.264 return True265 266 267+def resolve_cert_reqs(candidate):268+ """269+ Resolves the argument to a numeric constant, which can be passed to270+ the wrap_socket function/method from the ssl module.271+ Defaults to :data:`ssl.CERT_NONE`.272+ If given a string it is assumed to be the name of the constant in the273+ :mod:`ssl` module or its abbrevation.274+ (So you can specify `REQUIRED` instead of `CERT_REQUIRED`.275+ If it's neither `None` nor a string we assume it is already the numeric276+ constant which can directly be passed to wrap_socket.277+ """278+ if candidate is None:279+ return CERT_NONE280+281+ if isinstance(candidate, str):282+ res = getattr(ssl, candidate, None)283+ if res is None:284+ res = getattr(ssl, 'CERT_' + candidate)285+ return res286+287+ return candidate288+289+290+def resolve_ssl_version(candidate):291+ """292+ like resolve_cert_reqs293+ """294+ if candidate is None:295+ return PROTOCOL_SSLv23296+297+ if isinstance(candidate, str):298+ res = getattr(ssl, candidate, None)299+ if res is None:300+ res = getattr(ssl, 'PROTOCOL_' + candidate)301+ return res302+303+ return candidate304+305 if SSLContext is not None: # Python 3.2+267- def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=CERT_NONE,306+ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,307 ca_certs=None, server_hostname=None,269- ssl_version=PROTOCOL_SSLv23):308+ ssl_version=None):309 """310 All arguments except `server_hostname` have the same meaning as for311 :func:`ssl.wrap_socket`312 4 unmodified lines317 context.verify_mode = cert_reqs318 if ca_certs:319 try:320 context.load_verify_locations(ca_certs)282- except TypeError as e: # Reraise as SSLError283- # FIXME: This block needs a test.321+ # Py32 raises IOError322+ # Py33 raises FileNotFoundError323+ except Exception as e: # Reraise as SSLError324 raise SSLError(e)325 if certfile:326 # FIXME: This block needs a test.327 context.load_cert_chain(certfile, keyfile)1 unmodified line329 return context.wrap_socket(sock, server_hostname=server_hostname)330 return context.wrap_socket(sock)331 332 else: # Python 3.1 and earlier293- def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=CERT_NONE,333+ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,334 ca_certs=None, server_hostname=None,295- ssl_version=PROTOCOL_SSLv23):335+ ssl_version=None):336 return wrap_socket(sock, keyfile=keyfile, certfile=certfile,337 ca_certs=ca_certs, cert_reqs=cert_reqs,338 ssl_version=ssl_version)modified:requests/adapters.py+2 added-5 removed
9 unmodified lines10 11 import socket12 13 from .models import Response14-from .packages.urllib3.poolmanager import PoolManager, proxy_from_url14+from .packages.urllib3.poolmanager import PoolManager, ProxyManager15 from .packages.urllib3.response import HTTPResponse16-from .hooks import dispatch_hook16 from .compat import urlparse, basestring, urldefrag17 from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,18 prepend_scheme_if_needed)19 from .structures import CaseInsensitiveDict87 unmodified lines107 # Give the Response some context.108 response.request = req109 response.connection = self110 112- # Run the Response hook.113- response = dispatch_hook('response', req.hooks, response)111 return response112 113 def get_connection(self, url, proxies=None):114 """Returns a connection for the given URL."""1 unmodified line116 proxy = proxies.get(urlparse(url).scheme)117 118 if proxy:119 proxy = prepend_scheme_if_needed(proxy, urlparse(url).scheme)123- conn = proxy_from_url(proxy)120+ conn = ProxyManager(self.poolmanager.connection_from_url(proxy))121 else:122 conn = self.poolmanager.connection_from_url(url)123 124 return conn97 unmodified linesmodified:requests/auth.py+10 added-6 removed
66 unmodified lines67 68 realm = self.chal['realm']69 nonce = self.chal['nonce']70 qop = self.chal.get('qop')71- algorithm = self.chal.get('algorithm', 'MD5')72- opaque = self.chal.get('opaque', None)71+ algorithm = self.chal.get('algorithm')72+ opaque = self.chal.get('opaque')73 74+ if algorithm is None:75+ _algorithm = 'MD5'76+ else:74- algorithm = algorithm.upper()77+ _algorithm = algorithm.upper()78 # lambdas assume digest modules are imported at the top level76- if algorithm == 'MD5':79+ if _algorithm == 'MD5':80 def md5_utf8(x):81 if isinstance(x, str):82 x = x.encode('utf-8')83 return hashlib.md5(x).hexdigest()84 hash_utf8 = md5_utf882- elif algorithm == 'SHA':85+ elif _algorithm == 'SHA':86 def sha_utf8(x):87 if isinstance(x, str):88 x = x.encode('utf-8')89 return hashlib.sha1(x).hexdigest()41 unmodified lines131 base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \132 'response="%s"' % (self.username, realm, nonce, path, respdig)133 if opaque:134 base += ', opaque="%s"' % opaque135+ if algorithm:136+ base += ', algorithm="%s"' % algorithm137 if entdig:138 base += ', digest="%s"' % entdig134- base += ', algorithm="%s"' % algorithm139 if qop:140 base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)141 142 return 'Digest %s' % (base)30 unmodified linesmodified:requests/cacert.pem-48 removed
1601 unmodified lines1602 vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO31603 oKfN5XozNmr6mis=1604 -----END CERTIFICATE-----1605 1606-TURKTRUST Certificate Services Provider Root 11607-==============================================1608------BEGIN CERTIFICATE-----1609-MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOcUktUUlVTVCBF1610-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGDAJUUjEP1611-MA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykgMjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV01612-acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMx1613-MDI3MTdaFw0xNTAzMjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsg1614-U2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYDVQQHDAZB1615-TktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBC1616-aWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOC1617-AQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GX1618-yGl8hMW0kWxsE2qkVa2kheiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8i1619-Si9BB35JYbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5CurKZ1620-8y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1JuTm5Rh8i27fbMx41621-W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51b0dewQIDAQABoxAwDjAMBgNVHRME1622-BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu461623-sWrv7/hg0Uw2ZkUd82YCdAR7kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxE1624-q8Sn5RTOPEFhfEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy1625-B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdAaLX/7KfS0zgY1626-nNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKSRGQDJereW26fyfJOrN3H1627------END CERTIFICATE-----1628-1629-TURKTRUST Certificate Services Provider Root 21630-==============================================1631------BEGIN CERTIFICATE-----1632-MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF1633-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP1634-MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg1635-QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN1636-MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr1637-dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G1638-A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls1639-acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G1640-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe1641-LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI1642-x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g1643-QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr1644-5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB1645-AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G1646-A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt1647-Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE41648-Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+1649-hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P1650-9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk51651-UrbnBEI=1652------END CERTIFICATE-----1653-1606 SwissSign Gold CA - G21607 ======================1608 -----BEGIN CERTIFICATE-----1609 MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw1681 unmodified linesmodified:requests/certs.py+1 added-9 removed
12 unmodified lines13 """14 15 import os.path16 17-certifi = None18-try:19- import certifi20-except ImportError:21- pass22-17 def where():18 """Return the preferred certificate bundle."""25- if certifi:26- return certifi.where()27-19+ # vendored bundle inside Requests20 return os.path.join(os.path.dirname(__file__), 'cacert.pem')21 22 if __name__ == '__main__':23 print(where())modified:requests/models.py+17 added-11 removed
27 unmodified lines28 is_py2, chardet, json, builtin_str, basestring)29 30 REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)31 CONTENT_CHUNK_SIZE = 10 * 102432-ITER_CHUNK_SIZE = 10 * 102432+ITER_CHUNK_SIZE = 51233 34 log = logging.getLogger(__name__)35 36 83 unmodified lines120 if isinstance(fp, str):121 fp = StringIO(fp)122 if isinstance(fp, bytes):123 fp = BytesIO(fp)124- 124+125 if ft:126 new_v = (fn, fp.read(), ft)127 else:128 new_v = (fn, fp.read())154 unmodified lines283 284 # Support for unicode domain names and paths.285 scheme, netloc, path, _params, query, fragment = urlparse(url)286 287- if not scheme:287+ if not (scheme and netloc):288 raise MissingSchema("Invalid URL %r: No schema supplied" % url)289 290 try:291 netloc = netloc.encode('idna').decode('utf-8')54 unmodified lines346 not isinstance(data, dict)347 ])348 349 try:350- length = super_len(data)350+ length = str(super_len(data))351 except (TypeError, AttributeError):352 length = False353 354 if is_stream:20 unmodified lines375 content_type = None376 else:377 content_type = 'application/x-www-form-urlencoded'378 379- self.headers['Content-Length'] = '0'380- if hasattr(body, 'seek') and hasattr(body, 'tell'):381- body.seek(0, 2)382- self.headers['Content-Length'] = str(body.tell())383- body.seek(0, 0)384- elif body is not None:385- self.headers['Content-Length'] = str(len(body))379+ self.prepare_content_length(body)380 381 # Add content-type if it wasn't explicitly provided.382 if (content_type) and (not 'content-type' in self.headers):383 self.headers['Content-Type'] = content_type384 385 self.body = body386 387+ def prepare_content_length(self, body):388+ self.headers['Content-Length'] = '0'389+ if hasattr(body, 'seek') and hasattr(body, 'tell'):390+ body.seek(0, 2)391+ self.headers['Content-Length'] = str(body.tell())392+ body.seek(0, 0)393+ elif body is not None:394+ self.headers['Content-Length'] = str(len(body))395+396 def prepare_auth(self, auth):397 """Prepares the given HTTP auth data."""398 if auth:399 if isinstance(auth, tuple) and len(auth) == 2:5 unmodified lines405 406 # Update self to reflect the auth changes.407 self.__dict__.update(r.__dict__)408 409+ # Recompute Content-Length410+ self.prepare_content_length(self.body)411+412 def prepare_cookies(self, cookies):413 """Prepares the given HTTP cookie data."""414 415 if isinstance(cookies, cookielib.CookieJar):248 unmodified linesmodified:requests/sessions.py+7 added
273 unmodified lines274 275 # Prepare the Request.276 prep = req.prepare()277 278+ # If auth hooks are present, they aren't passed to `dispatch_hook`279+ # As such, we need to update the original hooks dictionary with them280+ hooks.update(prep.hooks)281+282 # Send the request.283 resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)284 285 # Persist cookies.11 unmodified lines297 history.insert(0, resp)298 resp = history.pop()299 resp.history = tuple(history)300 301+ # Response manipulation hook.302+ resp = dispatch_hook('response', hooks, resp)303+304 return resp305 306 def get(self, url, **kwargs):307 """Sends a GET request. Returns :class:`Response` object.104 unmodified linesmodified:requests/utils.py-2 removed
26 unmodified lines27 _hush_pyflakes = (RequestsCookieJar,)28 29 NETRC_FILES = ('.netrc', '_netrc')30 31-# if certifi is installed, use its CA bundle;32-# otherwise, try and use the OS bundle31 DEFAULT_CA_BUNDLE_PATH = certs.where()32 33 def dict_to_sequence(d):34 """Returns an internal sequence dictionary update."""548 unmodified linesmodified:.travis.yml+1 added
1 unmodified line2 python:3 - 2.64 - 2.75 - 3.26+ - 3.37 env: HTTPBIN_URL=http://httpbin.org/8 script: make test9 install:10 - make test-deps2 unmodified linesmodified:setup.py+1 added-1 removed
15 unmodified lines16 17 packages = [18 'requests',19 'requests.packages',20- 'requests.packages.charade',20+ 'requests.packages.charade',21 'requests.packages.urllib3',22 'requests.packages.urllib3.packages',23 'requests.packages.urllib3.packages.ssl_match_hostname'24 ]34 unmodified linesmodified:test_requests.py+6 added-2 removed
7 unmodified lines8 import unittest9 10 import requests11 from requests.auth import HTTPDigestAuth12+from requests.compat import str13 14+try:15+ import StringIO16+except ImportError:17+ import io as StringIO18+19 HTTPBIN = os.environ.get('HTTPBIN_URL', 'http://httpbin.org/')20 21 def httpbin(*suffix):22 """Returns url for HTTPBIN resource."""113 unmodified lines136 r = requests.put(httpbin('put'))137 self.assertEqual(r.status_code, 200)138 139 def test_BASICAUTH_TUPLE_HTTP_200_OK_GET(self):134-135-140 auth = ('user', 'pass')141 url = httpbin('basic-auth', 'user', 'pass')142 143 r = requests.get(url, auth=auth)143 unmodified lines