diff options
author | mkaay <mkaay@mkaay.de> | 2009-11-09 13:38:32 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2009-11-09 13:38:32 +0100 |
commit | cd500e34c6af6ce6ae8ed4b0086a7955c45a57eb (patch) | |
tree | 987698f7b2265abbc9241d51e6e5d386609003f6 /module/network | |
parent | Added tag v0.2.2 for changeset 0f85b895018a (diff) | |
download | pyload-cd500e34c6af6ce6ae8ed4b0086a7955c45a57eb.tar.xz |
uploaded.to premium
Diffstat (limited to 'module/network')
-rwxr-xr-x | module/network/Request.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/module/network/Request.py b/module/network/Request.py index 742111a2a..092e75a01 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -93,9 +93,6 @@ class Request: self.pycurl.setopt(pycurl.CONNECTTIMEOUT, 30) self.pycurl.setopt(pycurl.NOSIGNAL, 1) self.pycurl.setopt(pycurl.NOPROGRESS, 0) - cookie_file = "module" + sep + "cookies.txt" - self.pycurl.setopt(pycurl.COOKIEFILE, cookie_file) - self.pycurl.setopt(pycurl.COOKIEJAR, cookie_file) self.pycurl.setopt(pycurl.PROGRESSFUNCTION, self.progress) self.pycurl.setopt(pycurl.AUTOREFERER, 1) self.pycurl.setopt(pycurl.HEADERFUNCTION, self.write_header) @@ -127,6 +124,9 @@ class Request: self.pycurl.setopt(pycurl.URL, url) self.pycurl.setopt(pycurl.WRITEFUNCTION, self.rep.write) + + if cookies: + self.curl_enable_cookies() if post: self.pycurl.setopt(pycurl.POSTFIELDS, post) @@ -167,6 +167,11 @@ class Request: return output + def curl_enable_cookies(self): + cookie_file = "module" + sep + "cookies.txt" + self.pycurl.setopt(pycurl.COOKIEFILE, cookie_file) + self.pycurl.setopt(pycurl.COOKIEJAR, cookie_file) + def add_auth(self, user, pw): self.auth = True @@ -228,6 +233,9 @@ class Request: self.pycurl.setopt(pycurl.URL, url) self.pycurl.setopt(pycurl.WRITEDATA, fp) + + if cookies: + self.curl_enable_cookies() if post: self.pycurl.setopt(pycurl.POSTFIELDS, post) |