diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-02 00:45:18 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-02 00:45:18 +0200 |
commit | 33c7df15649ab3dbb963b58eb852d3e2876d31be (patch) | |
tree | 92ea835d25363afe7ac20a36f66834b509a0d13d /module/network | |
parent | fixed no log folder bug, more logs instead of prints (diff) | |
download | pyload-33c7df15649ab3dbb963b58eb852d3e2876d31be.tar.xz |
new reconnect method, hard to test
Diffstat (limited to 'module/network')
-rwxr-xr-x | module/network/Request.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/module/network/Request.py b/module/network/Request.py index 196e350c9..ce6dc6c8c 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -90,7 +90,7 @@ class Request: #def download(url, filename, reporthook = None, data = None): #default von urlretrieve auch None? # return self.downloader.urlretrieve(url, filename, reporthook, data) - def download(self, url, filename, post = {}): + def download(self, url, filename, post={}): if post: post = urllib.urlencode(post) @@ -100,14 +100,13 @@ class Request: if not self.dl: self.dl = True file = open(filename, 'wb') - req = urllib2.Request(url, post) - - conn = self.downloader.open(req) + req = urllib2.Request(url) + conn = self.downloader.open(req, post) self.dl_size = int(conn.headers["content-length"]) self.dl_arrived = 0 self.dl_time = time.time() - for chunk in conn: - self.dl_arrived += len(chunk) + for chunk in conn: + self.dl_arrived += len(chunk) file.write(chunk) file.close() self.dl = False |