blob: 8186fcf67735aa0d4252089f25b4837a83266a0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import sys
"""
Add alies for python2 and python3 libs and fucntions.
"""
if sys.version_info[0]== 3:
import http.client as httpclient
from urllib.parse import urlparse
text = str
bytebuffer = memoryview
elif sys.version_info[0] == 2:
import httplib as httpclient
from urlparse import urlparse
text = unicode
bytebuffer = buffer
else:
raise ImportError("Unknown python version:{0}".format(sys.version_info))
|