tcalmant / jsonrpclib

A Python (2 & 3) JSON-RPC over HTTP that mirrors the syntax of xmlrpclib (aka jsonrpclib-pelix)
https://jsonrpclib-pelix.readthedocs.io/
Apache License 2.0
53 stars 24 forks source link

Python 2.7.9 support -- AttributeError: 'SafeTransport' object has no attribute 'context' #10

Closed tuxxy closed 9 years ago

tuxxy commented 9 years ago

I'm running Python 2.7.8 and I get this issue after running: import jsonrpclib server = jsonrpclib.ServerProxy('https://<server>:<port>') print(server.derp)

and this is the result.

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/tux/code/xmsso/venv/local/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line 557, in __call__ return self.__send(self.__name, kwargs) File "/home/tux/code/xmsso/venv/local/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line 434, in _request response = self._run_request(request) File "/home/tux/code/xmsso/venv/local/lib/python2.7/site-packages/jsonrpclib/jsonrpc.py", line 467, in _run_request verbose=self.__verbose File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request return self.single_request(host, handler, request_body, verbose) File "/usr/lib/python2.7/xmlrpclib.py", line 1293, in single_request h = self.make_connection(host) File "/usr/lib/python2.7/xmlrpclib.py", line 1509, in make_connection self._connection = host, HTTPS(chost, None, context=self.context, **(x509 or {})) AttributeError: 'SafeTransport' object has no attribute 'context'

tcalmant commented 9 years ago

Is it a standard distribution of Python ?

I've looked at xmlrpclib.py on Python 2.7.8 and 2.7.6 (Win, Mac & Ubuntu), they both have the following line, without the context argument, at line 1496 (instead of 1509): self._connection = host, HTTPS(chost, None, **(x509 or {}))

tuxxy commented 9 years ago

Yes, this is a standard distribution. On Jan 16, 2015 1:42 AM, "Thomas Calmant" notifications@github.com wrote:

Is it a standard distribution of Python ?

I've looked at xmlrpclib.py on Python 2.7.8 and 2.7.6 (Win, Mac & Ubuntu), they both have the following line (without the context argument) at line 1496: self._connection = host, HTTPS(chost, None, **(x509 or {}))

— Reply to this email directly or view it on GitHub https://github.com/tcalmant/jsonrpclib/issues/10#issuecomment-70223610.

tcalmant commented 9 years ago

According to this issue22960 and patch, this is new in the 2.7.9 version of xmlrpclib.

tcalmant commented 9 years ago

Patch tested on Python 2.7.8, 2.7.9 and 3.4.2 jsonrpclib-pelix 0.2.3 has been released with this patch.

tuxxy commented 9 years ago

Great! Thanks! On Jan 16, 2015 6:38 AM, "Thomas Calmant" notifications@github.com wrote:

Patch tested on Python 2.7.8, 2.7.9 and 3.4.2 jsonrpclib-pelix 0.2.3 has been released with this patch.

— Reply to this email directly or view it on GitHub https://github.com/tcalmant/jsonrpclib/issues/10#issuecomment-70254296.