xmlrpclib - methodHelp doesn't work

Kent Johnson kent37 at tds.net
Tue Jun 7 13:54:21 EDT 2005


srinivasanr at gmail.com wrote:
> I tried out the examples in this website for XML-RPC using python -
> http://www.onlamp.com/pub/a/python/2000/11/22/xmlrpcclient.html?page=2
> But I get the following errors when I try to execute the code. Here is
> the snippet of the code with the error messages.

>>>>meerkatsvr.system.methodSignature(meerkat.getChannels)
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> NameError: name 'meerkat' is not defined
> 
>>>>meerkatsvr.system.methodHelp(meerkat.getItems)
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> NameError: name 'meerkat' is not defined

You have to give the method names as strings. Your code is looking for a 'getChannels' or 'getItems' attribute of something named 'meerkat', but there is no such name in the current scope. Try this:

Type "help", "copyright", "credits" or "license" for more information.
 >>> import xmlrpclib
 >>> meerkatURI = "http://www.oreillynet.com/meerkat/xml-rpc/server.php"
 >>> meerkatsvr = xmlrpclib.Server(meerkatURI)
 >>> meerkatsvr.system.listMethods()
['meerkat.getChannels', 'meerkat.getCategories', 'meerkat.getCategoriesBySubstring', 'meerkat.getChannelsByCategory', 'meerkat.getChannelsBySubstring', 'meerkat.getItems', 'system.listMethods', 'system.methodHelp', 'system.methodSignature']
 >>> print meerkatsvr.system.methodSignature('meerkat.getChannels')
[['array']]
 >>> print meerkatsvr.system.methodHelp('meerkat.getItems')
Returns an array of structs of RSS items given a recipe struct.
<etc>

Kent



More information about the Python-list mailing list