python xmlrpc client with ssl client certificates and standard modules

mdipierro massimodipierro71 at
Mon Jan 4 09:59:39 CET 2010

xmlrpc acts at the application layer and ssl at the transport layer so
they can inter operate easily as long as you do not use the
certificate to authenticate the client but only validate the server
and encrypt data (which you can also do but it is more complicated)

One option for you is to use web2py which include an xmlrpc server
that uses a wsgi ssl enabled web server.

Here is how:

1) Install web2py
2) Visit and create a new application from
the web based IDE
3) create your web service for example, in a controller

     def add(a,b): return int(a)+int(b)

4) Restart web2py with


5) You can now access the service from any Python program:

     >>> import xmlrpclib
     >>> server_url = 'https://myserver:443/yourapp/default/call/
     >>> server = xmlrpclib.Server(server_url)
     >>> print server.add(3,4)

Hope this helps.

On Jan 3, 8:12 pm, News123 <news... at> wrote:
> Hi,
> I was googling fot quite some time and was not really succesfull.
> I found one solution, which I will try soon.
> It is
> (found in
> This will probably work, but it requires the module M2Crypto.
> In order to avoid installing M2Crypto an all hosts that want to run the
> script I wondered, whether there is no other solution.
> I can do xmlrpc over ssl WITHOUT certificates with following code:
> import xmlrpclib
> server_url = 'https://myserver'
> server = xmlrpclib.Server(server_url);
> and I can perform a https get request WITH certificates with below snippet:
> import httplib
> conn = httplib.HTTPSConnection(
>         HOSTNAME,
>         key_file = KEYFILE,
>         cert_file = CERTFILE
> )
> conn.putrequest('GET', '/')
> conn.endheaders()
> response = conn.getresponse()
> print
> I'm just lost of how to 'combine' both.
> Thanks in advance for any suggestions / hints
> N

More information about the Python-list mailing list