summaryrefslogtreecommitdiffstats
path: root/module/network/Request.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-08 12:23:28 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-08 12:23:28 +0200
commit7b6a6cb94c8c2abc449351a1238227f9b10b0872 (patch)
treecc419ba50b1cbab369949c0be45ccc2e82c57dba /module/network/Request.py
parentFixed the YouPorn.com Plugin (diff)
downloadpyload-7b6a6cb94c8c2abc449351a1238227f9b10b0872.tar.xz
core able to push data to gui, proxy support: closed #1
Diffstat (limited to 'module/network/Request.py')
-rwxr-xr-xmodule/network/Request.py13
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: