X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=curlwrapper.py;h=a877b07516fe8ff82eee54447a54727298771d8c;hb=refs%2Fheads%2Fpython3;hp=08223e39a2499411cfbd99b56139a49604748ca0;hpb=06f279903af675e9a05668a3aa63c4b054faf6f7;p=nodemanager.git diff --git a/curlwrapper.py b/curlwrapper.py index 08223e3..a877b07 100644 --- a/curlwrapper.py +++ b/curlwrapper.py @@ -7,7 +7,7 @@ from subprocess import PIPE, Popen from select import select -import xmlrpclib +import xmlrpc.client import signal import os @@ -28,14 +28,14 @@ def retrieve(url, cacert=None, postdata=None, timeout=90): if timeout: command += ('--max-time', str(timeout)) command += ('--connect-timeout', str(timeout)) - command += (url,) + command += (url, ) if verbose: - print 'Invoking ',command - if postdata: print 'with postdata=',postdata + print('Invoking ', command) + if postdata: print('with postdata=', postdata) p = Sopen(command , stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) if postdata: p.stdin.write(postdata) p.stdin.close() - sout, sin, serr = select([p.stdout,p.stderr],[],[], timeout) + sout, sin, serr = select([p.stdout, p.stderr], [], [], timeout) if len(sout) == 0 and len(sin) == 0 and len(serr) == 0: logger.verbose("curlwrapper: timed out after %s" % timeout) p.kill(signal.SIGKILL) @@ -45,6 +45,6 @@ def retrieve(url, cacert=None, postdata=None, timeout=90): if rc != 0: # when this triggers, the error sometimes doesn't get printed logger.log ("curlwrapper: retrieve, got stderr <%s>"%err) - raise xmlrpclib.ProtocolError(url, rc, err, postdata) + raise xmlrpc.client.ProtocolError(url, rc, err, postdata) else: return data