houxmlrpc module

A module to give enhanced XMLRPC access to HOM.

It is “enhanced” in a few ways:

  • It uses the None/Null extension to XMLRPC (this is technically non-standard, but most implementations support it).

  • Provides client/server non-primitive type wrappers. What this means is that for any type that XMLRPC cannot marshal, the server will return a “remote object reference”, which is a 2-tuple of the form (‘types.’ + typeName, objectId):

    typeName is the name of the type (can be anything, but see below

    for description of typeMethods)

    objectId is an integer representing this object

    This module’s ServerProxy class, when it encounters a remote object reference, will replace it with a remote object proxy. It does this by creating a object proxy that saves its objectId, and by binding all methods that begin with ‘typeMethods.’ + typeName to the proxy. The list of available methods is obtained with the XMLRPC system.listMethods() call.

  • If the first parameter of a function call is a session identifier, then the specified session is used to track objects. This parameter is then removed from the list of parameters passed on to the server-side function call. If no session identifier is specified, then an anonymous session will be used. Session identifiers are of the form: (‘sessionid’, sessionId)

These issues do not prevent a standard XMLRPC client implementation from connecting to this XMLRPC server, the object proxies are merely for client programmer’s convenience.

To start a server (in a new thread), run:
houxmlrpc.run(port=8888)

This function returns the thread that was created.

To attach to the server from a client, run:
s = houxmlrpc.ServerProxy(‘http://localhost:8888’)
Consider this example using the object proxies:

root = s.hou.root() for c in root.children():

print c.path()
as opposed to this example without using the object proxies:

root = s.hou.root() for c in s.hou.typeMethods.hou.Node.children(root):

print s.hou.typeMethods.hou.Node.path(c)
class houxmlrpc.HouXMLRPCServer(addr=('localhost', 8888), logRequests=False, maxSessions=10, maxSessionObjs=1000)

Bases: SimpleXMLRPCServer.SimpleXMLRPCServer

allow_reuse_address = True
delObj(objId, sessId)
serve_forever()
stop()

Stops the XMLRPC Server

class houxmlrpc.ServerProxy(*args, **kw)

Bases: xmlrpclib.ServerProxy