2014-03-27 21:06:03 +00:00
|
|
|
try:
|
|
|
|
from urllib.parse import urljoin
|
|
|
|
except ImportError:
|
|
|
|
from urlparse import urljoin
|
|
|
|
|
|
|
|
|
2014-04-23 06:24:08 +00:00
|
|
|
try:
|
|
|
|
import cPickle as pickle
|
|
|
|
except ImportError:
|
|
|
|
import pickle
|
|
|
|
|
|
|
|
|
2015-04-28 17:32:10 +00:00
|
|
|
# Handle the case where the requests module has been patched to not have
|
|
|
|
# urllib3 bundled as part of its source.
|
2014-04-23 06:24:08 +00:00
|
|
|
try:
|
2015-04-28 17:32:10 +00:00
|
|
|
from requests.packages.urllib3.response import HTTPResponse
|
2014-04-23 06:24:08 +00:00
|
|
|
except ImportError:
|
|
|
|
from urllib3.response import HTTPResponse
|
2015-04-28 17:32:10 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
from requests.packages.urllib3.util import is_fp_closed
|
|
|
|
except ImportError:
|
|
|
|
from urllib3.util import is_fp_closed
|
2016-01-12 00:00:58 +00:00
|
|
|
|
|
|
|
# Replicate some six behaviour
|
|
|
|
try:
|
2017-07-12 00:36:15 +00:00
|
|
|
text_type = unicode
|
2016-01-12 00:00:58 +00:00
|
|
|
except NameError:
|
2017-07-12 00:36:15 +00:00
|
|
|
text_type = str
|