diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-22 14:59:28 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-22 14:59:28 +0100 |
commit | 3425f84f8ba4aa1fa3d124bb0f1ebf5e9c1119df (patch) | |
tree | 9bac2cf51ff90862c253a652333f7ac133e68435 /module | |
parent | cleaned request factory (diff) | |
download | pyload-3425f84f8ba4aa1fa3d124bb0f1ebf5e9c1119df.tar.xz |
fixed getURL
Diffstat (limited to 'module')
-rw-r--r-- | module/network/Browser.py | 2 | ||||
-rw-r--r-- | module/network/HTTPBase.py | 4 | ||||
-rw-r--r-- | module/network/RequestFactory.py | 16 | ||||
-rw-r--r-- | module/plugins/hooks/UpdateManager.py | 2 |
4 files changed, 11 insertions, 13 deletions
diff --git a/module/network/Browser.py b/module/network/Browser.py index 3d2d5a73f..dc4fd11aa 100644 --- a/module/network/Browser.py +++ b/module/network/Browser.py @@ -21,7 +21,7 @@ class Browser(object): self.bucket = bucket self.http = HTTPBase(interface=interface, proxies=proxies) - self.setCookieJar(cookieJar if cookieJar else CookieJar()) + self.setCookieJar(cookieJar) self.proxies = proxies def setCookieJar(self, cookieJar): diff --git a/module/network/HTTPBase.py b/module/network/HTTPBase.py index fead2f4ed..4fff15335 100644 --- a/module/network/HTTPBase.py +++ b/module/network/HTTPBase.py @@ -311,7 +311,7 @@ class HTTPBase(): opener.addheaders[0] = ("User-Agent", self.userAgent) return opener - def createRequest(self, url, get={}, post={}, referer=None, cookies=True, customHeaders={}): + def createRequest(self, url, get={}, post={}, referer=None, customHeaders={}): if get: if isinstance(get, dict): get = urlencode(get) @@ -337,7 +337,7 @@ class HTTPBase(): return req def getResponse(self, url, get={}, post={}, referer=None, cookies=True, customHeaders={}): - req = self.createRequest(url, get, post, referer, cookies, customHeaders) + req = self.createRequest(url, get, post, referer, customHeaders) opener = self.createOpener(cookies) if self.debug: diff --git a/module/network/RequestFactory.py b/module/network/RequestFactory.py index d73ab5e20..89d1aaf64 100644 --- a/module/network/RequestFactory.py +++ b/module/network/RequestFactory.py @@ -46,14 +46,12 @@ class RequestFactory(): self.lock.release() return req - def getURL(self, url): - base = HTTPBase() - #@TODO proxies - #@TODO post,get... + def getURL(self, url, get={}, post={}): + #a bit to much overhead for single url + b = Browser() + #@TODO proxies, iface - resp = base.getResponse(url) - resp = resp.read() - return resp + return b.getPage(url, get, post) def getCookieJar(self, pluginName, account=None): if self.cookiejars.has_key((pluginName, account)): @@ -64,5 +62,5 @@ class RequestFactory(): return cj # needs pyreq in global namespace -def getURL(url): - pyreq.getURL(url)
\ No newline at end of file +def getURL(url, get={}, post={}): + return pyreq.getURL(url, get, post)
\ No newline at end of file diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index b0fc766cb..70fd15fad 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -19,7 +19,7 @@ """ from os.path import join -from module.network.Request import getURL +from module.network.RequestFactory import getURL from module.plugins.Hook import Hook class UpdateManager(Hook): |