[Twisted-Python] XML-RPC questions

Cillian Sharkey cns at RedBrick.dcu.ie
Tue Mar 16 14:40:43 EST 2004

Hi folks,

Couple of questions.. (sorry for the long mail)


Has anyone coded HTML API generation a la DocXMLRPCServer (in Python
2.3) for Twisted's XML-RPC?

I have a basic implementation that for any GET request spits out an ugly
HTML list by using the XML-RPC introspection calls. If someone has done
something similar (well, *better*) I'd be interested in hearing.


To implement this I'm doing:

class Test(xmlrpc.XMLRPC):
    def render(self, request):
        if HTTP Basic AUTH ok:
	    # Let resource delegate request based on the method type
            return resource.Resource.render(self, request)
            return 401 HTML page

    def render_POST(self, request):
    	# All POST requests are XML-RPC calls.
        return xmlrpc.XMLRPC.render(self, request)

    def render_GET(self, request):
    	# All GET requests get the HTML API.
        return HTML for API

This works, but I'm curious if this is the 'right' way to do this?


HTTP is a stateless protocol, but I'll be using persistent HTTP/1.1
connections (with practically no timeouts) and would like to link such a
connection to a state/session object for each client connection. I can
use cookies for this, but given that the connection is kept open, is
there a better way to do this? I realise HTTP as a transport for my
setup probably isn't the most elegant solution, but it's easy to use.

Thanks for any help,


More information about the Twisted-Python mailing list