summaryrefslogtreecommitdiffstats
path: root/module/network
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-02 00:45:18 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-02 00:45:18 +0200
commit33c7df15649ab3dbb963b58eb852d3e2876d31be (patch)
tree92ea835d25363afe7ac20a36f66834b509a0d13d /module/network
parentfixed no log folder bug, more logs instead of prints (diff)
downloadpyload-33c7df15649ab3dbb963b58eb852d3e2876d31be.tar.xz
new reconnect method, hard to test
Diffstat (limited to 'module/network')
-rwxr-xr-xmodule/network/Request.py11
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