summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKjetil Jacobsen <kjetilja@gmail.com>2004-02-11 14:11:00 +0000
committerKjetil Jacobsen <kjetilja@gmail.com>2004-02-11 14:11:00 +0000
commit17ee6f875585eeeb582670799ad207aff4c101cd (patch)
tree66a0594e1700d2b59b7ec29ce28ada7cde7d0335 /python
parent3bf9fca69ede5bdb243e07bbac5dfc8c529a0cb5 (diff)
downloadpycurl-17ee6f875585eeeb582670799ad207aff4c101cd.tar.gz
- added set_timeout method which sets the connect timeout and the generalREL_7_10_11_PRE1
timeout
Diffstat (limited to 'python')
-rw-r--r--python/curl/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/curl/__init__.py b/python/curl/__init__.py
index a192410..8fecb4d 100644
--- a/python/curl/__init__.py
+++ b/python/curl/__init__.py
@@ -36,8 +36,7 @@ class Curl:
# handle cookie capture and playback automatically.
self.set_option(pycurl.COOKIEFILE, "/dev/null")
# Set timeouts to avoid hanging too long
- self.set_option(pycurl.CONNECTTIMEOUT, 30)
- self.set_option(pycurl.TIMEOUT, 300)
+ self.set_timeout(30)
# Use password identification from .netrc automatically
self.set_option(pycurl.NETRC, 1)
# Set up a callback to capture the payload
@@ -48,6 +47,11 @@ class Curl:
self.header.write(x)
self.set_option(pycurl.HEADERFUNCTION, header_callback)
+ def set_timeout(self, timeout):
+ "Set timeout for connect and object retrieval (applies for both)"
+ self.set_option(pycurl.CONNECTTIMEOUT, timeout)
+ self.set_option(pycurl.TIMEOUT, timeout)
+
def set_url(self, url):
"Set the base URL to be retrieved."
self.base_url = url