Welcome, guest | Sign In | My Account | Store | Cart

This simple recipe shows how you can pull recipes from O'Reilly's meerkat service using xml-rpc.

Python, 9 lines
from xmlrpclib import Server
from pprint import pprint

query = {'search':'Python', 'time_period':'7DAYS',}
meerkatURI = 'http://www.oreillynet.com/meerkat/xml-rpc/server.php'

meerkatSrv = Server(meerkatURI)
data = meerkatSrv.meerkat.getItems(query)

This is a simple xml-rpc recipe to call Meerkat the OReilly resource centre. It passes two arguments: search and time_period in a dict. meerkatSrv is an instance of the xml-rpc server, we then call the method getItems on meerkat, passing through query.

More information on Meerkat can be found at: http://www.oreillynet.com/meerkat/.

I run this script regularly with a slight modification, the data is parsed into html and loaded into my browser so I can click on links to the articles.


Hamish Lawson 20 years, 5 months ago  # | flag

Information on where to get xmlrpclib. Perhaps it should be mentioned that xmlrpclib is not in the standard library; it may be useful to give details of how it may be obtained (refer to the Vaults of Parnassus?).

David Brown 20 years, 4 months ago  # | flag

xmlrpclib to be included in Python 2.2. It has been checked in to the source tree for Python 2.2, until then you can get it at Python Labs here: http://www.pythonware.com/downloads/index.htm#xmlrpc

Greg Wilson 20 years, 4 months ago  # | flag

Duplicate text in example? Is the text of the example correct? Everything from the second import of "pprint" down seems to duplicate the first few lines.

andy mckay (author) 20 years, 3 months ago  # | flag

Duplicated text. Oops, thanks.

Created by andy mckay on Tue, 22 May 2001 (PSF)
Python recipes (4591)
andy mckay's recipes (8)

Required Modules

Other Information and Tasks