diff options
| author | 2014-11-09 02:45:39 +0100 | |
|---|---|---|
| committer | 2014-11-09 02:45:39 +0100 | |
| commit | 22b346dc7ad12178d247ffbe113b0c8585f72b06 (patch) | |
| tree | b07d8440fee3e983d32b928474cd16301954eb84 /module | |
| parent | [Captcha9kw] Fix a couple of typo (diff) | |
| download | pyload-22b346dc7ad12178d247ffbe113b0c8585f72b06.tar.xz | |
Cookie support for getURL method
Diffstat (limited to 'module')
| -rw-r--r-- | module/network/RequestFactory.py | 15 | 
1 files changed, 13 insertions, 2 deletions
| diff --git a/module/network/RequestFactory.py b/module/network/RequestFactory.py index 5b1528281..750f37dc9 100644 --- a/module/network/RequestFactory.py +++ b/module/network/RequestFactory.py @@ -62,12 +62,23 @@ class RequestFactory():      def getURL(self, *args, **kwargs):          """ see HTTPRequest for argument list """ -        h = HTTPRequest(None, self.getOptions()) +        cj = None + +        if 'cookies' in kwargs: +            if isinstance(kwargs['cookies'], CookieJar): +                cj = kwargs['cookies'] +            elif isinstance(kwargs['cookies'], list): +                cj = CookieJar(None) +                for cookie in kwargs['cookies']: +                    if isinstance(cookie, tuple) and len(cookie) == 3: +                        cj.setCookie(*cookie) + +        h = HTTPRequest(cj, self.getOptions())          try:              rep = h.load(*args, **kwargs)          finally:              h.close() -             +          return rep      def getCookieJar(self, pluginName, account=None): | 
