From e260b201f94a2a1e470b85a6499ea70e20a11277 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 26 Jun 2009 11:37:44 +0200 Subject: Cli stable, able to abort downloads, pause/kill server --- module/network/Request.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'module/network') diff --git a/module/network/Request.py b/module/network/Request.py index 0b518cf66..346412446 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -24,6 +24,9 @@ from cStringIO import StringIO retrieveUrl returns response as string """ +class AbortDownload(Exception): + pass + class Request: def __init__(self): @@ -33,6 +36,8 @@ class Request: self.dl_arrived = 0 self.dl = False + self.abort = False + self.cookies = [] self.lastURL = None self.cj = cookielib.CookieJar() @@ -146,6 +151,7 @@ class Request: 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() -- cgit v1.2.3