1 #!/usr/local/bin/python
\r
3 from xmlrpclib import *
\r
6 server = Server("http://phpxmlrpc.sourceforge.net/server.php")
\r
9 print "Got '" + server.examples.getStateName(32) + "'"
\r
11 r = server.mail.send("edd", "Test",
\r
12 "Bonjour. Je m'appelle Gérard. Mañana. ", "freddy", "", "",
\r
13 'text/plain; charset="iso-8859-1"')
\r
15 print "Mail sent OK"
\r
17 print "Error sending mail"
\r
20 r = server.examples.echo('Three "blind" mice - ' + "See 'how' they run")
\r
23 # name/age example. this exercises structs and arrays
\r
25 a = [ {'name': 'Dave', 'age': 35}, {'name': 'Edd', 'age': 45 },
\r
26 {'name': 'Fred', 'age': 23}, {'name': 'Barney', 'age': 36 }]
\r
27 r = server.examples.sortByAge(a)
\r
31 b = Binary("Mary had a little lamb She tied it to a pylon")
\r
32 b.encode(sys.stdout)
\r
33 r = server.examples.decode64(b)
\r
37 print "XML-RPC Error:",v
\r