diff options
author | spoob <spoob@gmx.de> | 2009-08-09 04:48:35 +0200 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2009-08-09 04:48:35 +0200 |
commit | 69ec3ccdee225f1b8e00542b1dee737a51bdc18b (patch) | |
tree | c1cc43401eb481ec5fed5ddc228a7f7e1f8d59da /module/network | |
parent | pyloadCli local switch fix (diff) | |
download | pyload-69ec3ccdee225f1b8e00542b1dee737a51bdc18b.tar.xz |
fixed megaupload bug
Diffstat (limited to 'module/network')
-rwxr-xr-x | module/network/Request.py | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/module/network/Request.py b/module/network/Request.py index 30ffbcd3e..8e3ece456 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -9,6 +9,7 @@ import base64 import cookielib import time import urllib +from urllib2 import URLError, HTTPError import urllib2 from gzip import GzipFile @@ -146,22 +147,27 @@ class Request: if not self.dl: self.dl = True file = open(filename, 'wb') - conn = self.downloader.open(req, post) - if conn.headers.has_key("content-length"): - self.dl_size = int(conn.headers["content-length"]) - else: - self.dl_size = 0 - self.dl_arrived = 0 - self.dl_time = time.time() - for chunk in conn: - if self.abort: raise AbortDownload - self.dl_arrived += len(chunk) - file.write(chunk) - - file.close() - self.dl = False - self.dl_finished = time.time() - return True + try: + conn = self.downloader.open(req, post) + if conn.headers.has_key("content-length"): + self.dl_size = int(conn.headers["content-length"]) + else: + self.dl_size = 0 + self.dl_arrived = 0 + self.dl_time = time.time() + for chunk in conn: + if self.abort: raise AbortDownload + self.dl_arrived += len(chunk) + file.write(chunk) + + file.close() + self.dl = False + self.dl_finished = time.time() + return True + except HTTPError, e: + print e + except URLError, e: + print e def get_speed(self): try: |