summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-05-06 17:53:48 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-05-06 17:53:48 +0200
commit66b84a69745e41e8543ffd7ee0abb137a81f2563 (patch)
tree93d8894761b08fd0f1ba3870f475892f7dd22cfc /module
parentnew request factory (diff)
downloadpyload-66b84a69745e41e8543ffd7ee0abb137a81f2563.tar.xz
better request factory
Diffstat (limited to 'module')
-rw-r--r--module/RequestFactory.py21
-rwxr-xr-xmodule/network/Request.py7
2 files changed, 17 insertions, 11 deletions
diff --git a/module/RequestFactory.py b/module/RequestFactory.py
index a2a3ad902..9b56f4778 100644
--- a/module/RequestFactory.py
+++ b/module/RequestFactory.py
@@ -29,17 +29,20 @@ class RequestFactory():
def getRequest(self, pluginName, account=None):
self.lock.acquire()
+ cookieFile = None
for req in self.requests:
if req[0:2] == (pluginName, account):
- self.lock.release()
- return req[2]
- name = pluginName
- if account:
- name += "_"
- name += account
- th = NamedTemporaryFile(mode="w", prefix="pyload_cookies_%s" % name, delete=False)
- cookieFile = th.name
- th.close()
+ cookieFile = req[2].cookieFile
+ break
+
+ if not cookieFile:
+ name = pluginName
+ if account:
+ name += "_"
+ name += account
+ th = NamedTemporaryFile(mode="w", prefix="pyload_cookies_%s" % name, delete=False)
+ cookieFile = th.name
+ th.close()
req = Request(cookieFile)
self.requests.append((pluginName, account, req))
diff --git a/module/network/Request.py b/module/network/Request.py
index 73ba06e2f..3340a74da 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -347,10 +347,13 @@ class Request:
def clean(self):
try:
- remove(self.cookieFile)
self.pycurl.close()
except:
- print "cant clean"
+ pass
+ try:
+ remove(self.cookieFile)
+ except Exception as e:
+ pass
def getURL(url):
"""