Skip to content

Commit

Permalink
Merge pull request #2378 from dstufft/upgrade-requests
Browse files Browse the repository at this point in the history
Upgrade requests to 2.5.1
(cherry picked from commit db02b1a)
  • Loading branch information
dstufft committed Jan 28, 2015
1 parent e56f50e commit ec51b69
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pip/_vendor/requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"""

__title__ = 'requests'
__version__ = '2.5.0'
__build__ = 0x020500
__version__ = '2.5.1'
__build__ = 0x020501
__author__ = 'Kenneth Reitz'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2014 Kenneth Reitz'
Expand Down
7 changes: 4 additions & 3 deletions pip/_vendor/requests/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, username, password):
self.nonce_count = 0
self.chal = {}
self.pos = None
self.num_401_calls = 1

def build_digest_header(self, method, url):

Expand Down Expand Up @@ -154,7 +155,7 @@ def sha_utf8(x):
def handle_redirect(self, r, **kwargs):
"""Reset num_401_calls counter on redirects."""
if r.is_redirect:
setattr(self, 'num_401_calls', 1)
self.num_401_calls = 1

def handle_401(self, r, **kwargs):
"""Takes the given response and tries digest-auth, if needed."""
Expand All @@ -168,7 +169,7 @@ def handle_401(self, r, **kwargs):

if 'digest' in s_auth.lower() and num_401_calls < 2:

setattr(self, 'num_401_calls', num_401_calls + 1)
self.num_401_calls += 1
pat = re.compile(r'digest ', flags=re.IGNORECASE)
self.chal = parse_dict_header(pat.sub('', s_auth, count=1))

Expand All @@ -188,7 +189,7 @@ def handle_401(self, r, **kwargs):

return _r

setattr(self, 'num_401_calls', num_401_calls + 1)
self.num_401_calls = 1
return r

def __call__(self, r):
Expand Down
2 changes: 1 addition & 1 deletion pip/_vendor/requests/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
try:
import simplejson as json
except (ImportError, SyntaxError):
# simplejson does not support Python 3.2, it thows a SyntaxError
# simplejson does not support Python 3.2, it throws a SyntaxError
# because of u'...' Unicode literals.
import json

Expand Down
14 changes: 8 additions & 6 deletions pip/_vendor/requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
from .packages.urllib3.filepost import encode_multipart_formdata
from .packages.urllib3.util import parse_url
from .packages.urllib3.exceptions import (
DecodeError, ReadTimeoutError, ProtocolError)
DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
from .exceptions import (
HTTPError, RequestException, MissingSchema, InvalidURL,
ChunkedEncodingError, ContentDecodingError, ConnectionError,
StreamConsumedError)
HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
ContentDecodingError, ConnectionError, StreamConsumedError)
from .utils import (
guess_filename, get_auth_from_url, requote_uri,
stream_decode_response_unicode, to_key_val_list, parse_header_links,
Expand Down Expand Up @@ -351,7 +350,10 @@ def prepare_url(self, url, params):
return

# Support for unicode domain names and paths.
scheme, auth, host, port, path, query, fragment = parse_url(url)
try:
scheme, auth, host, port, path, query, fragment = parse_url(url)
except LocationParseError as e:
raise InvalidURL(*e.args)

if not scheme:
raise MissingSchema("Invalid URL {0!r}: No schema supplied. "
Expand Down Expand Up @@ -615,7 +617,7 @@ def __iter__(self):
def ok(self):
try:
self.raise_for_status()
except RequestException:
except HTTPError:
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion pip/_vendor/requests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_netrc_auth(url):
def guess_filename(obj):
"""Tries to guess the filename of the given object."""
name = getattr(obj, 'name', None)
if name and name[0] != '<' and name[-1] != '>':
if name and isinstance(name, builtin_str) and name[0] != '<' and name[-1] != '>':
return os.path.basename(name)


Expand Down
2 changes: 1 addition & 1 deletion pip/_vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ distlib==0.2.0
html5lib==0.999 # See: https://github.com/html5lib/html5lib-python/issues/161
six==1.8.0
colorama==0.3.2
requests==2.5.0
requests==2.5.1
certifi==14.05.14
CacheControl==0.10.7
lockfile==0.10.2
Expand Down

0 comments on commit ec51b69

Please sign in to comment.