diff options
author | spoob <spoob@gmx.de> | 2009-06-16 16:50:59 +0200 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2009-06-16 16:50:59 +0200 |
commit | c0da328490dcae4ceab6416ef8d48d9262c1aad3 (patch) | |
tree | 54ef14373d85855a122857e85d5e8f4db3414b76 /module/network | |
parent | fixed file_list bug (diff) | |
download | pyload-c0da328490dcae4ceab6416ef8d48d9262c1aad3.tar.xz |
Added Zippyshare.com Download Plugin
Diffstat (limited to 'module/network')
-rwxr-xr-x | module/network/Request.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/module/network/Request.py b/module/network/Request.py index cce89f92e..2b3545dd8 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -71,12 +71,9 @@ class Request: url = url + get req = urllib2.Request(url, data=post) - - if ref and self.lastURL is not None: req.add_header("Referer", self.lastURL) - if cookies: self.add_cookies(req) #add cookies @@ -112,17 +109,36 @@ class Request: self.opener.add_handler(handler) self.downloader.add_handler(handler) - def download(self, url, filename, post={}): + def download(self, url, filename, get={}, post={}, ref=True, cookies=False): if post: post = urllib.urlencode(post) else: post = None + if get: + get = urllib.urlencode(get) + else: + get = "" + + url = url + get + req = urllib2.Request(url, data=post) + + if ref and self.lastURL is not None: + req.add_header("Referer", self.lastURL) + + if cookies: + self.add_cookies(req) + #add cookies + + rep = self.opener.open(req) + + for cookie in self.cj.make_cookies(rep, req): + self.cookies.append(cookie) + if not self.dl: self.dl = True file = open(filename, 'wb') - req = urllib2.Request(url) conn = self.downloader.open(req, post) if conn.headers.has_key("content-length"): self.dl_size = int(conn.headers["content-length"]) @@ -155,4 +171,4 @@ class Request: if __name__ == "__main__": import doctest - doctest.testmod()
\ No newline at end of file + doctest.testmod() |