Yahoo BOSS python api

By : lakshman

Yahoo has a search api with generous limits, BOSS. There are a few python apis around it. But we wanted a lighter api, and one which has the same interface as out Bing Python api. So here is the updated bingapi.(Now with bossapi.py as well). Or svn it from here


Usage

Usage is mostly compatible with bingapi

In [2]: from bingapi import bossapi

In [3]: api = bossapi.Boss('<appid>')

In [4]: api.do_web_search('Uswaretech')
Out[4]: ....

In [5]: api.do_news_search('salsa')
Out[5]: ...

In [6]: api.do_siteexplorer_search('http://uswaretech.com')
Out[6]: .....


Related Posts


Can we help you build amazing apps? Contact us today.

Topics : API search yahoo

Comments

Tom Bateman 5th July, 2009

This is great. Does anybody know how to offset the results in the same way as Bing?

commmenttor
shabda

Tom:

http://developer.yahoo.com/search/boss/boss_guide/
It accepts all options described here as keyword arguments.

commmenttor
Dan 9th July, 2009

I think there's a bug in this code.

On line 24, the "query" parameter needs to be quoted. Add "from urllib import quote" somewhere, and then, on line 24, do:
final_url = base_url%(type_, quote(query), payload)
This bug is not normally manifest, because (as far as I can tell) urllib will escape those characters itself. However, if you (as I have) port the code to Google App Engine and use Google's "urlfetch" instead, you may find yourself baffled by this for hours.

;)

commmenttor
Marc Puig

Thanks Dan, I was having some problems with the bossapi and I solved thanks to your comment!

commmenttor
shabda

I updated the code. So if you checkout from the source, you should not have this problem. Let me if you do.

commmenttor
© Agiliq, 2009-2012