json over https

265 views
Skip to first unread message

Julian

unread,
Nov 2, 2010, 1:18:29 AM11/2/10
to JSONRPClib (Python)
Hi the library works for me over a 'unsecure' connection but fails for
HTTPS (port 443)
The end of the trace is:
File "C:\Python26\lib\xmlrpclib.py", line 1238, in request
self.send_content(h, request_body)
TypeError: unbound method send_content() must be called with Transport
instance as first argument (got HTTPS instance in stead)

The error is being emitted by the xmlrpclib, but it may have something
to do with how it is being subclassed, if that's what you call it. I
can't figure out where everything is being instantiated. Its bombing
out before anything is sent to the server.

This is locals() just before the crash:
{'verbose': 0, 'request_body': '{"jsonrpc": "2.0", "params":
["place"], "id": "98k37m53", "method": "db_list"}', 'h':
<httplib.HTTPS instance at 0x0191B850>, 'self':
<jsonrpclib.jsonrpc.SafeTransport instance at 0x019BE878>, 'host':
'a.real.domain.name:443', 'handler': ''}

hope you can help.
thanks

Josh Marshall

unread,
Nov 3, 2010, 2:05:17 AM11/3/10
to jsonr...@googlegroups.com
Hey Julian --

Thanks for pointing this out. First off, you were right, there was an error in the client. I've made the change and pushed it to github, however note that the SimpleJSONRPCServer doesn't support SSL without some involved subclassing (just like the SimpleXMLRPCServer) so I haven't had a chance to test it and see if works with an actual https:// server yet. It now throws the same sslerror exception that the XMLRPClib client throws when trying to call https without the appropriate certificates, so I guess that gets us one step closer.

Hopefully over the next week or two, I can look into what it would take to enable SSL certificates on the SimpleJSONRPCServer, but if you are using an external https JSON-RPC server, please let me know if this gets you any closer to a working connection. 

Thanks again for your help in making this a better library!

Josh Marshall

Julian

unread,
Nov 3, 2010, 6:28:21 PM11/3/10
to JSONRPClib (Python)
Hi Josh
your fixes work
I really appreciate your efforts and how quickly you responded.
Thank you very much.

Josh Marshall

unread,
Nov 3, 2010, 6:31:08 PM11/3/10
to jsonr...@googlegroups.com
No problem -- glad it worked!

Just curious, what service are you connecting to? (If it's private, you can ignore me. :)) I like trying out my system on existing platforms to check compatibility.

Thanks again for telling me about the bug!

Josh Marshall
Reply all
Reply to author
Forward
0 new messages