X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FPyCurl.py;h=4ae2fdc9a4a7d9663c67214146ff08328933c537;hb=19d4a01ccf66af9e00914351b3eacd5fc880f988;hp=32051b4ee64b7fa52c84f2c49d5bc35e6ad5cde1;hpb=b9034d9c8f7e923d13aae4fe23e894cfc31f214a;p=plcapi.git diff --git a/PLC/PyCurl.py b/PLC/PyCurl.py index 32051b4..4ae2fdc 100644 --- a/PLC/PyCurl.py +++ b/PLC/PyCurl.py @@ -5,8 +5,6 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id$ -# import os import xmlrpclib @@ -15,7 +13,8 @@ from tempfile import NamedTemporaryFile class PyCurlTransport(xmlrpclib.Transport): def __init__(self, uri, cert = None, timeout = 300): - xmlrpclib.Transport.__init__(self) + if hasattr(xmlrpclib.Transport,'__init__'): + xmlrpclib.Transport.__init__(self) self.curl = pycurl.Curl() # Suppress signals @@ -50,7 +49,7 @@ class PyCurlTransport(xmlrpclib.Transport): self.body = "" def body(buf): self.body += buf - self.curl.setopt(pycurl.WRITEFUNCTION, body) + self.curl.setopt(pycurl.WRITEFUNCTION, body) def request(self, host, handler, request_body, verbose = 1): # Set verbosity @@ -72,7 +71,7 @@ class PyCurlTransport(xmlrpclib.Transport): if errcode == 60: raise Exception, "PyCurl: SSL certificate validation failed" elif errcode != 200: - raise Exception, "PyCurl: HTTP error %d -- %r" % (errcode,errmsg) + raise Exception, "PyCurl: HTTP error %d -- %r" % (errcode,errmsg) # Parse response p, u = self.getparser()