aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/livestreamer/compat.py
blob: 142f39c6a475d91a9d6ca748b927fad4c82f1e4b (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
#!/usr/bin/env python

import sys

orig_str = str

def str(s, enc=None):
    if sys.version_info[0] == 3:
        return orig_str(s, enc)
    else:
        return orig_str(s)


orig_bytes = bytes

def bytes(s, enc=None):
    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