diff options
author | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:25 -0700 |
---|---|---|
committer | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:25 -0700 |
commit | 9f376f89bdf80a40914218d64cd9cd61b25f449d (patch) | |
tree | 6205015b49c53a3178573532cfcd10dcd7f2d121 /requests/compat.py | |
parent | d4aa2de2bb89ca384ad81db731bb99735e1db788 (diff) | |
download | python-requests-9f376f89bdf80a40914218d64cd9cd61b25f449d.tar python-requests-9f376f89bdf80a40914218d64cd9cd61b25f449d.tar.gz |
Imported Upstream version 1.1.0
Diffstat (limited to 'requests/compat.py')
-rw-r--r-- | requests/compat.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/requests/compat.py b/requests/compat.py index 37063f5..5bd4fcb 100644 --- a/requests/compat.py +++ b/requests/compat.py @@ -4,6 +4,7 @@ pythoncompat """ +from .packages import charade as chardet import sys @@ -72,34 +73,42 @@ is_osx = ('darwin' in str(sys.platform).lower()) is_hpux = ('hpux' in str(sys.platform).lower()) # Complete guess. is_solaris = ('solar==' in str(sys.platform).lower()) # Complete guess. +try: + import simplejson as json +except ImportError: + import json # --------- # Specifics # --------- - if is_py2: - from urllib import quote, unquote, urlencode - from urlparse import urlparse, urlunparse, urljoin, urlsplit + from urllib import quote, unquote, quote_plus, unquote_plus, urlencode + from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag from urllib2 import parse_http_list import cookielib from Cookie import Morsel from StringIO import StringIO + from .packages.urllib3.packages.ordered_dict import OrderedDict + builtin_str = str bytes = str str = unicode basestring = basestring + numeric_types = (int, long, float) elif is_py3: - from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote + from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag from urllib.request import parse_http_list from http import cookiejar as cookielib from http.cookies import Morsel from io import StringIO + from collections import OrderedDict + builtin_str = str str = str bytes = bytes - basestring = (str,bytes) - + basestring = (str, bytes) + numeric_types = (int, float) |