We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The xmlrpclib Module

(New in 2.2) XML-RPC client library.

# File: xmlrpclib-example-1.py

import xmlrpclib

server = xmlrpclib.ServerProxy("http://effbot.org/rpc/echo.cgi")
result = server.echo("hello")

hello

The library also contains tools to marshal and unmarshal XML-RPC requests.

# File: xmlrpclib-example-2.py

import xmlrpclib

args = 1, 2.0, "three"

params = xmlrpclib.dumps(args)

args, method = xmlrpclib.loads(params)

print params
print args
<params>
<param>
<value><int>1</int></value>
</param>
<param>
<value><double>2.0</double></value>
</param>
<param>
<value><string>hello</string></value>
</param>
</params>
(1, 2.0, 'hello')