FrontPage
»
XMLRPCAuthentication
HowTo: Authentication via XML-RPC (xmlrpclib)
As of version 1.0.1, Fredrik Lundh's xmlrpclib supports Basic Authentication. It is incredibly easy to use. Here is an example:
su-2.05a$ python2.2 >>> import xmlrpclib >>> server=xmlrpclib.Server("http://admin:adminpass@localhost:8585/") >>> print server.acl_users.manage_main()
This would print out the HTML one would see upon viewing source of the main acl_users
folder through a web browser.
In a script, you might like to do something like the following:
import xmlrpclib proto = "http" user = "admin" pass = "asecret" host = "localhost" port = "8080" uri = "%s://%s:%s@%s:%s/" % (proto,user,pass,host,port) server = xmlrpclib.Server(uri) ... etc.