[Python-il] xmlrpc over ssl
meir at mksoft.co.il
Tue Jan 8 00:07:41 IST 2008
Dan Kenigsberg wrote:
> Dear List,
> I saw that creating an XML-RPC client-server system in python is very simple.
> However, when I wanted to see how to do it all over SSL, everything got
> complicated. I'd like the server to authenticate the client, and hopefully vice
> versa. What is the recommended way of doing it?
> Random search has led me to pyOpenSSL examples, where one finds
> SecureXMLRPCServer.py, which "acts exactly like SimpleXMLRPCServer".
> What I had in mind is the following:
> ==== server.py ====
> #import SimpleXMLRPCServer
> import SecureXMLRPCServer
> def echo(s):
> return s
> #s = SimpleXMLRPCServer.SimpleXMLRPCServer(('127.0.0.1', 4040))
> s = SecureXMLRPCServer.SecureXMLRPCServer(('127.0.0.1', 4040))
> s.register_function(echo, 'echo')
> ==== client.py ====
> import xmlrpclib
> #server = xmlrpclib.Server('http://localhost:4040')
> #print server.echo('hello')
> server = xmlrpclib.Server('https://localhost:4040')
> print server.echo('hello')
> which ended with the client throwing xmlrpclib.ProtocolError: <ProtocolError for
> localhost:4040/RPC2: 500 Internal Server Error>. This all worked nicely when I
> tried it over http instead of https.
> I am rather new to Python (and frankly, not very familiar with SSL), so
> please be gentle :-)
Maybe this can help (note the comments regarding a change for python 2.5):
More information about the Python-il