xmlrpc with Basic Auth

Bryan belred at gmail.com
Fri Sep 15 23:20:39 EDT 2006


Milos Prudek wrote:
> 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?
> 


i'm currently using xmlrpclib with basic auth and i use it like this:


from xmlrpclib import Server
s=Server("http://user:pwd@www.example.com/rpc.php")


bryan




More information about the Python-list mailing list