diff options
Diffstat (limited to 'module/network')
| -rw-r--r-- | module/network/Browser.py | 2 | ||||
| -rw-r--r-- | module/network/HTTPBase.py | 4 | ||||
| -rw-r--r-- | module/network/RequestFactory.py | 16 | 
3 files changed, 10 insertions, 12 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  | 
