Yahoo BOSS python api

by lakshman on June 14, 2009

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:

  1. Python Wrapper on Bing API
  2. Django-SocialAuth – Login via twitter, facebook, openid, yahoo, google using a single app.
  3. New tutorial – Building a search engine with Appengine and Yahoo
  4. Develop Twitter API application in django and deploy on Google App Engine
  5. Constraint programming in Python

{ 5 comments… read them below or add one }

1 Tom Bateman July 5, 2009 at 9:09 am

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

2 shabda July 5, 2009 at 9:15 am

Tom:

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

3 Dan July 9, 2009 at 2:42 pm

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.

;)

4 Marc Puig July 11, 2009 at 9:55 am

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

5 shabda July 14, 2009 at 5:29 am

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

Leave a Comment

Additional comments powered by BackType

Previous post:

Next post: