24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
httplib.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
#-- hooks to progress meter and status bar in main window
feedback = None
# Sets either text or percentage of main windows' status bar.
#
# Can either take a float parameter (e.g. 0.99 for % indicator)
# or text message. Alternatively two parameters to update both.
|
>
>
>
>
>
>
>
>
>
>
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
httplib.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
#-- ssl
try:
import certifi
from requests.packages.urllib3.exceptions import InsecureRequestWarning
ca_certs = certifi.where()
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
except Exception as e:
log.WARN("No SSL support. Try `sudo pip install urllib3[secure] certifi`", e)
ca_certs = False
#-- hooks to progress meter and status bar in main window
feedback = None
# Sets either text or percentage of main windows' status bar.
#
# Can either take a float parameter (e.g. 0.99 for % indicator)
# or text message. Alternatively two parameters to update both.
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
if feedback:
try: [feedback(d, timeout=timeout) for d in args]
except: pass
# prepare default query object
session = requests.Session()
# default HTTP headers for requests
session.headers.update({
"User-Agent": "streamtuner2/2.2 (X11; Linux amd64; rv:52.0) like WinAmp/2.1",
"Accept": "*/*",
"Accept-Language": "en-US,en,de,es,fr,it,*;q=0.1",
"Accept-Encoding": "gzip, deflate",
"Accept-Charset": "UTF-8, ISO-8859-1;q=0.5, *;q=0.1",
|
>
>
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
if feedback:
try: [feedback(d, timeout=timeout) for d in args]
except: pass
# prepare default query object
session = requests.Session()
session.verify = ca_certs
#log.SESS(session.__dict__)
# default HTTP headers for requests
session.headers.update({
"User-Agent": "streamtuner2/2.2 (X11; Linux amd64; rv:52.0) like WinAmp/2.1",
"Accept": "*/*",
"Accept-Language": "en-US,en,de,es,fr,it,*;q=0.1",
"Accept-Encoding": "gzip, deflate",
"Accept-Charset": "UTF-8, ISO-8859-1;q=0.5, *;q=0.1",
|