Skip to content
Myr

Merge commit 'v0.8.6'

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 · parents 19a2a6c, c910b95 · Browse files · 7 files+73 added−17 removed
This commit

State

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

Diff stats

7 files+73 added−17 removed

  • other:+73 added−17 removed

7 files+73 added−17 removed

modified:requests/packages/urllib3/connectionpool.py+30 added-9 removed
208 unmodified lines
209210 if timeout is _Default:211 timeout = self.timeout212213 conn.timeout = timeout # This only does anything in Py26+214215 conn.request(method, url, **httplib_request_kw)216 conn.sock.settimeout(timeout)217 httplib_response = conn.getresponse()218
26 unmodified lines
245246 More commonly, it's appropriate to use a convenience method provided247 by :class:`.RequestMethods`, such as :meth:`.request`.248249 .. note::250251 `release_conn` will only behave as expected if252 `preload_content=False` because we want to make253 `preload_content=False` the default behaviour someday soon without254 breaking backwards compatibility.255256 :param method:257 HTTP request method (such as GET, POST, PUT, etc.)258259 :param body:
27 unmodified lines
287 connection is available within the time period.288289 :param release_conn:290 If False, then the urlopen call will not release the connection282 back into the pool once a response is received. This is useful if283 you're not preloading the response's content immediately. You will284 need to call ``r.release_conn()`` on the response ``r`` to return285 the connection back into the pool. If None, it takes the value of291 back into the pool once a response is received (but will release if292 you read the entire contents of the response such as when293 `preload_content=True`). This is useful if you're not preloading294 the response's content immediately. You will need to call295 ``r.release_conn()`` on the response ``r`` to return the connection296 back into the pool. If None, it takes the value of297 ``response_kw.get('preload_content', True)``.298299 :param \**response_kw:300 Additional parameters are passed to
4 unmodified lines
305306 if retries < 0:307 raise MaxRetryError("Max retries exceeded for url: %s" % url)308309 if timeout is _Default:310 timeout = self.timeout311312 if release_conn is None:313 release_conn = response_kw.get('preload_content', True)314315 # Check host
33 unmodified lines
349 # The connection will be put back into the pool when350 # ``response.release_conn()`` is called (implicitly by351 # ``response.read()``)352339 except (SocketTimeout, Empty), e:340 # Timed out either by socket or queue341 raise TimeoutError("Request timed out after %s seconds" %342 self.timeout)353 except (Empty), e:354 # Timed out by queue355 raise TimeoutError("Request timed out. (pool_timeout=%s)" %356 pool_timeout)357358 except (SocketTimeout), e:359 # Timed out by socket360 raise TimeoutError("Request timed out. (timeout=%s)" %361 timeout)362363 except (BaseSSLError), e:364 # SSL certificate error365 raise SSLError(e)366
139 unmodified lines
506 # This code is actually similar to urlparse.urlsplit, but much507 # simplified for our needs.508 port = None509 scheme = 'http'491 if '//' in url:510 if '://' in url:511 scheme, url = url.split('://', 1)512 if '/' in url:513 url, _path = url.split('/', 1)514 if '@' in url:515 _auth, url = url.split('@', 1)516 if ':' in url:517 url, port = url.split(':', 1)518 port = int(port)519 return scheme, url, port
27 unmodified lines
modified:requests/__init__.py+2 added-2 removed
13 unmodified lines
1415"""1617__title__ = 'requests'18__version__ = '0.8.5'19__build__ = 0x00080518__version__ = '0.8.6'19__build__ = 0x00080620__author__ = 'Kenneth Reitz'21__license__ = 'ISC'22__copyright__ = 'Copyright 2011 Kenneth Reitz'23
11 unmodified lines
modified:requests/auth.py+16 added-4 removed
14 unmodified lines
1516from .utils import randombytes, parse_dict_header17181920def _basic_auth_str(username, password):21 """Returns a Basic Auth string."""22 return 'Basic %s' % b64encode('%s:%s' % (username, password))232425class AuthBase(object):26 """Base class that all auth implementations derive from"""2728 def __call__(self, r):
6 unmodified lines
35 self.username = str(username)36 self.password = str(password)3738 def __call__(self, r):33 auth_s = b64encode('%s:%s' % (self.username, self.password))34 r.headers['Authorization'] = ('Basic %s' % auth_s)39 r.headers['Authorization'] = _basic_auth_str(self.username, self.password)40 return r414243class HTTPProxyAuth(HTTPBasicAuth):44 """Attaches HTTP Proxy Authenetication to a given Request object."""45 def __call__(self, r):46 r.headers['Proxy-Authorization'] = _basic_auth_str(self.username, self.password)47 return r484950class HTTPDigestAuth(AuthBase):51 """Attaches HTTP Digest Authentication to the given Request object."""52 def __init__(self, username, password):53 self.username = username
33 unmodified lines
87 entdig = None88 p_parsed = urlparse(r.request.url)89 path = p_parsed.path + p_parsed.query9079 A1 = "%s:%s:%s" % (self.username, realm, self.password)80 A2 = "%s:%s" % (r.request.method, path)91 A1 = '%s:%s:%s' % (self.username, realm, self.password)92 A2 = '%s:%s' % (r.request.method, path)9394 if qop == 'auth':95 if nonce == last_nonce:96 nonce_count += 1
40 unmodified lines
modified:requests/models.py+7 added-1 removed
15 unmodified lines
16from .hooks import dispatch_hook17from .structures import CaseInsensitiveDict18from .status_codes import codes19from .packages import oreos20from .auth import HTTPBasicAuth20from .auth import HTTPBasicAuth, HTTPProxyAuth21from .packages.urllib3.exceptions import MaxRetryError22from .packages.urllib3.exceptions import SSLError as _SSLError23from .packages.urllib3.exceptions import HTTPError as _HTTPError24from .packages.urllib3 import connectionpool, poolmanager
381 unmodified lines
406 proxy = self.proxies.get(_p.scheme)407408 if proxy:409 conn = poolmanager.proxy_from_url(proxy)410 _proxy = urlparse(proxy)411 if '@' in _proxy.netloc:412 auth, url = _proxy.netloc.split('@', 1)413 self.proxy_auth = HTTPProxyAuth(*auth.split(':', 1))414 r = self.proxy_auth(self)415 self.__dict__.update(r.__dict__)416 else:417 # Check to see if keep_alive is allowed.418 if self.config.get('keep_alive'):419 conn = self._poolmanager.connection_from_url(url)
270 unmodified lines
modified:AUTHORS.rst+2 added-1 removed
62 unmodified lines
63- Rolando Espinoza La fuente64- Robert Gieseke65- Idan Gazit66- Ed Summers67- Chris Van Horne67- Chris Van Horne68- Christopher Davis
modified:HISTORY.rst+7 added
1History2-------340.8.6 (2011-12-18)5++++++++++++++++++67* Socket timeout fixes.8* Proxy Authorization support.910110.8.5 (2011-12-14)12++++++++++++++++++1314* Response.iter_lines!
280 unmodified lines
modified:Makefile+9 added
11 unmodified lines
1213site:14 cd docs; make dirhtml1516pyc:17 find . -name "*.pyc" -exec rm '{}' ';'1819deps:20 rm -fr requests/packages/urllib321 git clone https://github.com/shazow/urllib3.git22 mv urllib3/urllib3 requests/packages/23 rm -fr urllib32425docs: site