[Twisted-web] XMLRPC and keyword arguments

Andrew McNabb amcnabb at mcnabbs.org
Mon Mar 10 12:15:17 EDT 2008


I've made a simple extension to XMLRPC, and I was wondering if it is
something that I should contribute back to Twisted or if I should keep
it to myself.  In other words, would others find this useful?

The idea is that RPC methods might need to get at information in the
request.  For example, an RPC method might need to know what IP address
the request comes from or it might need to know if HTTP basic
authentication is set.  I'm sure I could come up with more examples.

Here how it's used:

class SomeXMLRPCClass(XMLRPC):
    def keywords(self, request):
        return {'client': request.client}

    def xmlrpc_echo(self, x, **kwds):
        client = kwds['client']
        # [do what you need to with client here]
        return x

Anyway, implementing this is incredibly simple, and I needed it for a
project I'm working on.  If it would be useful to others, I'd be happy
to create a ticket and post a patch.

Thanks.

-- 
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20080310/0dc5d1d4/attachment.pgp


More information about the Twisted-web mailing list