aboutsummaryrefslogtreecommitdiff
path: root/requests/utils.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:41:22 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:41:22 -0700
commit40337989ba5056432c9f2af3c42267e5ee9e3e18 (patch)
tree25a680529c68fcdd7886b4b064845c3e371e167e /requests/utils.py
parente75853fc04102c7f72f2e955b63f9692c472f64a (diff)
downloadpython-requests-40337989ba5056432c9f2af3c42267e5ee9e3e18.tar
python-requests-40337989ba5056432c9f2af3c42267e5ee9e3e18.tar.gz
Imported Upstream version 0.11.1
Diffstat (limited to 'requests/utils.py')
-rw-r--r--requests/utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/requests/utils.py b/requests/utils.py
index 6952a99..b722d99 100644
--- a/requests/utils.py
+++ b/requests/utils.py
@@ -14,7 +14,6 @@ import codecs
import os
import random
import re
-import traceback
import zlib
from netrc import netrc, NetrcParseError
@@ -26,6 +25,15 @@ from .compat import basestring, bytes, str
NETRC_FILES = ('.netrc', '_netrc')
+def dict_to_sequence(d):
+ """Returns an internal sequence dictionary update."""
+
+ if hasattr(d, 'items'):
+ d = d.items()
+
+ return d
+
+
def get_netrc_auth(url):
"""Returns the Requests tuple auth for a given url from netrc."""
@@ -51,7 +59,7 @@ def get_netrc_auth(url):
# Return with login / password
login_i = (0 if _netrc[0] else 1)
return (_netrc[login_i], _netrc[2])
- except (NetrcParseError, IOError):
+ except (NetrcParseError, IOError, AttributeError):
# If there was a parsing error or a permissions issue reading the file,
# we'll just skip netrc auth
pass