Skip to content
Myr

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

16 files+131 added−115 removed

modified:docs/user/advanced.rst+2 added-2 removed
142 unmodified lines
143144Requests 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::145146 with open('massive-body') as f:147 request.post('http://some.url/streamed', data=f)147 requests.post('http://some.url/streamed', data=f)148149150Chunk-Encoded Requests151----------------------
4 unmodified lines
156 def gen():157 yield 'hi'158 yield 'there'159160 request.post('http://some.url/chunked', data=gen())160 requests.post('http://some.url/chunked', data=gen())161162163Event Hooks164-----------
341 unmodified lines
modified:docs/user/quickstart.rst+3 added-3 removed
318 unmodified lines
319-------320321If a response contains some Cookies, you can get quick access to them::322323 >>> url = 'http://httpbin.org/cookies/set/requests-is/awesome'323 >>> url = 'http://example.com/some/cookie/setting/url'324 >>> r = requests.get(url)325326 >>> r.cookies['requests-is']327 'awesome'326 >>> r.cookies['example_cookie_name']327 'example_cookie_value'328329To send your own cookies to the server, you can use the ``cookies``330parameter::331
85 unmodified lines
modified:requests/packages/urllib3/connectionpool.py+11 added-15 removed
7 unmodified lines
8import socket9import errno1011from socket import error as SocketError, timeout as SocketTimeout12from .util import resolve_cert_reqs, resolve_ssl_version1314try: # Python 315 from http.client import HTTPConnection, HTTPException16 from http.client import HTTP_PORT, HTTPS_PORT
63 unmodified lines
80 ca_certs = None81 ssl_version = None8283 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):8586 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_certs9091 def connect(self):92 # Add certificate verification93 sock = socket.create_connection((self.host, self.port), self.timeout)9495 resolved_cert_reqs = resolve_cert_reqs(self.cert_reqs)96 resolved_ssl_version = resolve_ssl_version(self.ssl_version)9798 # 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)105107 if self.ca_certs:106 if resolved_cert_reqs != ssl.CERT_NONE:107 match_hostname(self.sock.getpeercert(), self.host)108109110## Pool objects
401 unmodified lines
512 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):517518 HTTPConnectionPool.__init__(self, host, port,519 strict, timeout, maxsize,520 block, headers)
25 unmodified lines
546 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)549551 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_version551552 return connection553554
25 unmodified lines
modified:requests/packages/urllib3/poolmanager.py+13 added-4 removed
56 unmodified lines
57 self.connection_pool_kw = connection_pool_kw58 self.pools = RecentlyUsedContainer(num_pools,59 dispose_func=lambda p: p.close())6061 def _new_pool(self, scheme, host, port):62 """63 Create a new :class:`ConnectionPool` based on host, port and scheme.6465 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)7172 def clear(self):73 """74 Empty our store of pools and direct them all to close.75
8 unmodified lines
8485 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)9091 pool_key = (scheme, host, port)92
3 unmodified lines
96 if pool:97 return pool9899 # 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)90100 pool = self._new_pool(scheme, host, port)101 self.pools[pool_key] = pool92102 return pool103104 def connection_from_url(self, url):105 """
67 unmodified lines
modified:requests/packages/urllib3/response.py+11 added-1 removed
143 unmodified lines
144 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 data159160 try:161 if decode_content and decoder:162 data = decoder(data)
52 unmodified lines
modified:requests/packages/urllib3/util.py+46 added-6 removed
20 unmodified lines
21try: # Test for SSL features22 SSLContext = None23 HAS_SNI = False2425 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?29except ImportError:
233 unmodified lines
263 # Either data is buffered (bad), or the connection is dropped.264 return True265266267def 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_NONE280281 if isinstance(candidate, str):282 res = getattr(ssl, candidate, None)283 if res is None:284 res = getattr(ssl, 'CERT_' + candidate)285 return res286287 return candidate288289290def resolve_ssl_version(candidate):291 """292 like resolve_cert_reqs293 """294 if candidate is None:295 return PROTOCOL_SSLv23296297 if isinstance(candidate, str):298 res = getattr(ssl, candidate, None)299 if res is None:300 res = getattr(ssl, 'PROTOCOL_' + candidate)301 return res302303 return candidate304305if 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 lines
317 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 line
329 return context.wrap_socket(sock, server_hostname=server_hostname)330 return context.wrap_socket(sock)331332else: # 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 lines
1011import socket1213from .models import Response14from .packages.urllib3.poolmanager import PoolManager, proxy_from_url14from .packages.urllib3.poolmanager import PoolManager, ProxyManager15from .packages.urllib3.response import HTTPResponse16from .hooks import dispatch_hook16from .compat import urlparse, basestring, urldefrag17from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,18 prepend_scheme_if_needed)19from .structures import CaseInsensitiveDict
87 unmodified lines
107 # Give the Response some context.108 response.request = req109 response.connection = self110112 # Run the Response hook.113 response = dispatch_hook('response', req.hooks, response)111 return response112113 def get_connection(self, url, proxies=None):114 """Returns a connection for the given URL."""
1 unmodified line
116 proxy = proxies.get(urlparse(url).scheme)117118 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)123124 return conn
97 unmodified lines
modified:requests/auth.py+10 added-6 removed
66 unmodified lines
6768 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')7374 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 lines
131 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)141142 return 'Digest %s' % (base)
30 unmodified lines
modified:requests/cacert.pem-48 removed
1601 unmodified lines
1602vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO31603oKfN5XozNmr6mis=1604-----END CERTIFICATE-----16051606TURKTRUST Certificate Services Provider Root 11607==============================================1608-----BEGIN CERTIFICATE-----1609MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOcUktUUlVTVCBF1610bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGDAJUUjEP1611MA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykgMjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV01612acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMx1613MDI3MTdaFw0xNTAzMjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsg1614U2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYDVQQHDAZB1615TktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBC1616aWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOC1617AQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GX1618yGl8hMW0kWxsE2qkVa2kheiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8i1619Si9BB35JYbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5CurKZ16208y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1JuTm5Rh8i27fbMx41621W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51b0dewQIDAQABoxAwDjAMBgNVHRME1622BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu461623sWrv7/hg0Uw2ZkUd82YCdAR7kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxE1624q8Sn5RTOPEFhfEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy1625B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdAaLX/7KfS0zgY1626nNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKSRGQDJereW26fyfJOrN3H1627-----END CERTIFICATE-----16281629TURKTRUST Certificate Services Provider Root 21630==============================================1631-----BEGIN CERTIFICATE-----1632MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF1633bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP1634MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg1635QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN1636MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr1637dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G1638A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls1639acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G1640CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe1641LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI1642x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g1643QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr16445A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB1645AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G1646A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt1647Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE41648Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+1649hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P16509Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk51651UrbnBEI=1652-----END CERTIFICATE-----16531606SwissSign Gold CA - G21607======================1608-----BEGIN CERTIFICATE-----1609MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
1681 unmodified lines
modified:requests/certs.py+1 added-9 removed
12 unmodified lines
13"""1415import os.path1617certifi = None18try:19 import certifi20except ImportError:21 pass2217def where():18 """Return the preferred certificate bundle."""25 if certifi:26 return certifi.where()2719 # vendored bundle inside Requests20 return os.path.join(os.path.dirname(__file__), 'cacert.pem')2122if __name__ == '__main__':23 print(where())
modified:requests/models.py+17 added-11 removed
27 unmodified lines
28 is_py2, chardet, json, builtin_str, basestring)2930REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)31CONTENT_CHUNK_SIZE = 10 * 102432ITER_CHUNK_SIZE = 10 * 102432ITER_CHUNK_SIZE = 5123334log = logging.getLogger(__name__)3536
83 unmodified lines
120 if isinstance(fp, str):121 fp = StringIO(fp)122 if isinstance(fp, bytes):123 fp = BytesIO(fp)124 124125 if ft:126 new_v = (fn, fp.read(), ft)127 else:128 new_v = (fn, fp.read())
154 unmodified lines
283284 # Support for unicode domain names and paths.285 scheme, netloc, path, _params, query, fragment = urlparse(url)286287 if not scheme:287 if not (scheme and netloc):288 raise MissingSchema("Invalid URL %r: No schema supplied" % url)289290 try:291 netloc = netloc.encode('idna').decode('utf-8')
54 unmodified lines
346 not isinstance(data, dict)347 ])348349 try:350 length = super_len(data)350 length = str(super_len(data))351 except (TypeError, AttributeError):352 length = False353354 if is_stream:
20 unmodified lines
375 content_type = None376 else:377 content_type = 'application/x-www-form-urlencoded'378379 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)380381 # 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_type384385 self.body = body386387 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))395396 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 lines
405406 # Update self to reflect the auth changes.407 self.__dict__.update(r.__dict__)408409 # Recompute Content-Length410 self.prepare_content_length(self.body)411412 def prepare_cookies(self, cookies):413 """Prepares the given HTTP cookie data."""414415 if isinstance(cookies, cookielib.CookieJar):
248 unmodified lines
modified:requests/sessions.py+7 added
273 unmodified lines
274275 # Prepare the Request.276 prep = req.prepare()277278 # 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)281282 # Send the request.283 resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)284285 # Persist cookies.
11 unmodified lines
297 history.insert(0, resp)298 resp = history.pop()299 resp.history = tuple(history)300301 # Response manipulation hook.302 resp = dispatch_hook('response', hooks, resp)303304 return resp305306 def get(self, url, **kwargs):307 """Sends a GET request. Returns :class:`Response` object.
104 unmodified lines
modified:requests/utils.py-2 removed
26 unmodified lines
27_hush_pyflakes = (RequestsCookieJar,)2829NETRC_FILES = ('.netrc', '_netrc')3031# if certifi is installed, use its CA bundle;32# otherwise, try and use the OS bundle31DEFAULT_CA_BUNDLE_PATH = certs.where()3233def dict_to_sequence(d):34 """Returns an internal sequence dictionary update."""
548 unmodified lines
modified:.travis.yml+1 added
1 unmodified line
2python:3 - 2.64 - 2.75 - 3.26 - 3.37env: HTTPBIN_URL=http://httpbin.org/8script: make test9install:10 - make test-deps
2 unmodified lines
modified:setup.py+1 added-1 removed
15 unmodified lines
1617packages = [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 lines
modified:test_requests.py+6 added-2 removed
7 unmodified lines
8import unittest910import requests11from requests.auth import HTTPDigestAuth12from requests.compat import str1314try:15 import StringIO16except ImportError:17 import io as StringIO1819HTTPBIN = os.environ.get('HTTPBIN_URL', 'http://httpbin.org/')2021def httpbin(*suffix):22 """Returns url for HTTPBIN resource."""
113 unmodified lines
136 r = requests.put(httpbin('put'))137 self.assertEqual(r.status_code, 200)138139 def test_BASICAUTH_TUPLE_HTTP_200_OK_GET(self):134135140 auth = ('user', 'pass')141 url = httpbin('basic-auth', 'user', 'pass')142143 r = requests.get(url, auth=auth)
143 unmodified lines