diff options
Diffstat (limited to 'module/network')
-rwxr-xr-x | module/network/Request.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/module/network/Request.py b/module/network/Request.py index 8e2b6ae02..de9000ab3 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -59,12 +59,12 @@ class Request: if post: post = urllib.urlencode(post) else: - post = None + post = None if get: - get = urllib.urlencode(get) + get = urllib.urlencode(get) else: - get = "" + get = "" url = url + get req = urllib2.Request(url, data=post) @@ -100,11 +100,16 @@ class Request: def add_cookies(self, req): cookie_head = "" for cookie in self.cookies: - cookie_head += cookie.name+"="+cookie.value+"; " + cookie_head += cookie.name + "=" + cookie.value + "; " req.add_header("Cookie", cookie_head) #def download(url, filename, reporthook = None, data = None): #default von urlretrieve auch None? # return self.downloader.urlretrieve(url, filename, reporthook, data) + def add_proxy(self, protocol, adress): + handler = urllib2.ProxyHandler({protocol: adress}) + self.opener.add_handler(handler) + self.downloader.add_handler(handler) + def download(self, url, filename, post={}): if post: |