xmlrpc with Basic Auth

Milos Prudek prudek at bvx.cz
Fri Sep 15 10:47:07 EDT 2006


I need to use XML-RPC call with Basic Authorization in HTTP headers. I found 
xmlrpclibBasicAuth.py, and it can be used as follows:

from xmlrpclibBasicAuth import Server
s=Server("http://www.example.com/rpc.php","user","pwd")
print s.system.listMethods()

Is this possible in plain xmlrpclib, without xmlrpclibBasicAuth.py? 

I found the Transport class in xmlrpclib, and it has a method "get_host_info", 
which parses "user:pwd" out of "user:pwd at host". But when I tried to 
instantiate Server, it threw error "unsupported XML-RPC protocol". Here is a 
snippet:

from xmlrpclib import Server
s=Server("user:pwd at http://www.example.com/rpc.php")
...
File "/usr/local/lib/python2.3/xmlrpclib.py", line 1293, in __init__
    raise IOError, "unsupported XML-RPC protocol"
IOError: unsupported XML-RPC protocol

I know that I am using it incorrectly. Does the basic authentication support 
in xmlrpclib mean something else than I take it for?

-- 
Milos Prudek



More information about the Python-list mailing list