diff options
Diffstat (limited to 'module')
| -rwxr-xr-x | module/network/Request.py | 28 | ||||
| -rw-r--r-- | module/thread_list.py | 4 | 
2 files changed, 24 insertions, 8 deletions
| diff --git a/module/network/Request.py b/module/network/Request.py index cce89f92e..2b3545dd8 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -71,12 +71,9 @@ class Request:          url = url + get          req = urllib2.Request(url, data=post) - -          if ref and self.lastURL is not None:              req.add_header("Referer", self.lastURL) -          if cookies:              self.add_cookies(req)              #add cookies @@ -112,17 +109,36 @@ class Request:          self.opener.add_handler(handler)          self.downloader.add_handler(handler) -    def download(self, url, filename, post={}): +    def download(self, url, filename, get={}, post={}, ref=True, cookies=False):          if post:              post = urllib.urlencode(post)          else:              post = None +        if get: +            get = urllib.urlencode(get) +        else: +            get = "" + +        url = url + get +        req = urllib2.Request(url, data=post) + +        if ref and self.lastURL is not None: +            req.add_header("Referer", self.lastURL) + +        if cookies: +            self.add_cookies(req) +            #add cookies + +        rep = self.opener.open(req) + +        for cookie in self.cj.make_cookies(rep, req): +            self.cookies.append(cookie) +          if not self.dl:              self.dl = True              file = open(filename, 'wb') -            req = urllib2.Request(url)              conn = self.downloader.open(req, post)              if conn.headers.has_key("content-length"):                  self.dl_size = int(conn.headers["content-length"]) @@ -155,4 +171,4 @@ class Request:  if __name__ == "__main__":      import doctest -    doctest.testmod()
\ No newline at end of file +    doctest.testmod() diff --git a/module/thread_list.py b/module/thread_list.py index a7e92b77d..677fe7ecc 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -117,8 +117,8 @@ class Thread_List(object):              data = data.replace(pyfile.url + '\n', "") -            with open(self.parent.config['link_file'], 'w') as f: -                f.write(data) +            #with open(self.parent.config['link_file'], 'w') as f: +                #f.write(data)          if pyfile.status.type == "reconnected":#put it back in queque              self.py_load_files.insert(0, pyfile) | 
