Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/requests/compat.py @ 0:d67268158946 draft
planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author | bcclaywell |
---|---|
date | Mon, 12 Oct 2015 17:43:33 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d67268158946 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 | |
3 """ | |
4 pythoncompat | |
5 """ | |
6 | |
7 from .packages import chardet | |
8 | |
9 import sys | |
10 | |
11 # ------- | |
12 # Pythons | |
13 # ------- | |
14 | |
15 # Syntax sugar. | |
16 _ver = sys.version_info | |
17 | |
18 #: Python 2.x? | |
19 is_py2 = (_ver[0] == 2) | |
20 | |
21 #: Python 3.x? | |
22 is_py3 = (_ver[0] == 3) | |
23 | |
24 try: | |
25 import simplejson as json | |
26 except (ImportError, SyntaxError): | |
27 # simplejson does not support Python 3.2, it throws a SyntaxError | |
28 # because of u'...' Unicode literals. | |
29 import json | |
30 | |
31 # --------- | |
32 # Specifics | |
33 # --------- | |
34 | |
35 if is_py2: | |
36 from urllib import quote, unquote, quote_plus, unquote_plus, urlencode, getproxies, proxy_bypass | |
37 from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag | |
38 from urllib2 import parse_http_list | |
39 import cookielib | |
40 from Cookie import Morsel | |
41 from StringIO import StringIO | |
42 from .packages.urllib3.packages.ordered_dict import OrderedDict | |
43 | |
44 builtin_str = str | |
45 bytes = str | |
46 str = unicode | |
47 basestring = basestring | |
48 numeric_types = (int, long, float) | |
49 | |
50 elif is_py3: | |
51 from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag | |
52 from urllib.request import parse_http_list, getproxies, proxy_bypass | |
53 from http import cookiejar as cookielib | |
54 from http.cookies import Morsel | |
55 from io import StringIO | |
56 from collections import OrderedDict | |
57 | |
58 builtin_str = str | |
59 str = str | |
60 bytes = bytes | |
61 basestring = (str, bytes) | |
62 numeric_types = (int, float) |