-def retrieve(url, cacert=None, postdata=None, timeout=300):
- options = ('/usr/bin/curl', '--fail', '--silent')
- if cacert: options += ('--cacert', cacert)
- if postdata: options += ('--data', '@-')
- if timeout: options += ('--max-time', str(timeout))
- p = Popen(options + (url,), stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
+def retrieve(url, cacert=None, postdata=None, timeout=90):
+# command = ('/usr/bin/curl', '--fail', '--silent')
+ command = ('/usr/bin/curl', '--fail', )
+ if cacert: command += ('--cacert', cacert)
+ if postdata: command += ('--data', '@-')
+ if timeout:
+ command += ('--max-time', str(timeout))
+ command += ('--connect-timeout', str(timeout))
+ command += (url, )
+ if verbose:
+ print('Invoking ', command)
+ if postdata: print('with postdata=', postdata)
+ p = Sopen(command , stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)