blob: c0d798e34679a6e2127a2b34f28f0e618b87bd2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env python
import sys
orig_str = str
def str(s, enc="ascii"):
if sys.version_info[0] == 3:
return orig_str(s, enc)
else:
return orig_str(s)
orig_bytes = bytes
def bytes(s, enc="ascii"):
if sys.version_info[0] == 3:
return orig_bytes(s, enc)
else:
return orig_bytes(s)
try:
import urllib.request as urllib
except ImportError:
import urllib2 as urllib
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
|