49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
})
#-- Retrieve data via HTTP
#
# Well, it says "get", but it actually does POST and AJAXish GET requests too.
#
def get(url, params={}, referer="", post=0, ajax=0, binary=0, feedback=None, content=True, verify=False, statusmsg=None):
# statusbar info
progress_feedback(url)
# combine headers
headers = {}
if ajax:
|
|
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
})
#-- Retrieve data via HTTP
#
# Well, it says "get", but it actually does POST and AJAXish GET requests too.
#
def get(url, params={}, referer="", post=0, ajax=0, binary=0, feedback=None, content=True, verify=False, statusmsg=None, encoding=None):
# statusbar info
progress_feedback(url)
# combine headers
headers = {}
if ajax:
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
statusmsg and progress_feedback(statusmsg)
if not content:
return r
elif binary:
r = r.content
else:
# Receival is actually happening here
r = r.text
# clean statusbar
statusmsg and progress_feedback()
return r
#-- Append missing trailing slash to URLs
|
>
>
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
statusmsg and progress_feedback(statusmsg)
if not content:
return r
elif binary:
r = r.content
else:
# Receival is actually happening here
if encoding:
r.encoding = encoding
r = r.text
# clean statusbar
statusmsg and progress_feedback()
return r
#-- Append missing trailing slash to URLs
|