Skip to content
A python opensearch client
Branch: master
Clone or download
edsu Merge pull request #7 from boyska/patch-1
FIX a typo was breaking `text/xml` descriptions #6
Latest commit e28a984 Jul 27, 2016


opensearch is a python library for talking to opensearch servers. Both v1.0 and v1.1 interactions are supported. You can find out more about opensearch at


Here's the basic idea:

from opensearch import Client

client = Client(description_url)
results ='zx81')

for result in results:
    print result.title,

If you have a template with some non-standard query parameters like key in this template:

   <Url type="application/atom+xml" template="{searchTerms}&amp;start={startIndex?}&amp;count={resultSize?}&amp;key={key}"/>

you can send the parameter like so:

results ='zx81', key="abc123")

If the template happens to use a namespace prefix, as in this real example from the OCLC Worldcat API, which uses wcapi:wskey:

<Url type="application/atom+xml" xmlns:wcapi="" template="{searchTerms}&amp;start={startIndex?}&amp;count={resultSize?}&amp;format=atom&amp;wskey={wcapi:wskey}&amp;cformat={wcapi:cformat?}"/>

You can supply wcapi:wskey using the underscore notation:

results ='zx81', wcapi__wskey="abc123")


If you run into trouble and would like to see what URLs are being accessed behind the scenes, turn on logging and set the log level to DEBUG:

import logging

To Do

  • handle v1.1 that want a POST instead of a GET
  • figure out if the latest feedparser can be used as a dependency
  • validate required parameters


The opensearch code itself has been released under the GPL.

One exception is that the distro bundles Mark Pilgrim's Universal Feed Parser, which is licensed separately under the MIT license. See opensearch/ for details on Mark's license.


Ed Summers

You can’t perform that action at this time.