<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Usware Blog - Django Web Development &#187; bing</title>
	<atom:link href="http://uswaretech.com/blog/tag/bing/feed/" rel="self" type="application/rss+xml" />
	<link>http://uswaretech.com/blog</link>
	<description>Building Amazing Webapps</description>
	<lastBuildDate>Tue, 08 Jun 2010 14:59:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Python Wrapper on Bing API</title>
		<link>http://uswaretech.com/blog/2009/06/bing-python-api/</link>
		<comments>http://uswaretech.com/blog/2009/06/bing-python-api/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 06:39:33 +0000</pubDate>
		<dc:creator>lakshman</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[bing]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://uswaretech.com/blog/?p=515</guid>
		<description><![CDATA[The newly launched search engine Bing has a simple restful API. We have created a thin Python wrapper over this API, which allows to query the Bing servers in a very pythonic way. Installing this is as easy as easy_install bingapi. [Or get it here or here ] Using from bingapi import bingapi bing = [...]


Related posts:<ol><li><a href='http://uswaretech.com/blog/2009/06/yahoo-boss-python-api/' rel='bookmark' title='Permanent Link: Yahoo BOSS python api'>Yahoo BOSS python api</a></li>
<li><a href='http://uswaretech.com/blog/2009/06/better-python-package-management-using-source-and-version-control-systems/' rel='bookmark' title='Permanent Link: Better Python package management using source and version control systems'>Better Python package management using source and version control systems</a></li>
<li><a href='http://uswaretech.com/blog/2009/03/finding-keywords-using-python/' rel='bookmark' title='Permanent Link: Finding keywords using Python'>Finding keywords using Python</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><p>The newly launched search engine <a href="http://www.bing.com/">Bing</a> has a simple restful API. We have created a thin Python wrapper over this API, which allows to query the Bing servers in a very pythonic way.</p>

<p>Installing this is as easy as <code>easy_install bingapi</code>.</p>

<p>[Or get it <a href="https://svn.uswaretech.com/bingapi/">here</a> or <a href="http://pypi.python.org/pypi/bingapi/0.01">here</a> ]</p>

<p>Using</p>

<pre><code>from bingapi import bingapi
bing = bingapi.Bing(&lt;appid&gt;)
bing.do_web_search('Usware Technologies')
</code></pre>

<hr />

<p>The README from the project is posted below, which provides more details on using this.</p>

<p>bingapi.py is a very thin python wrapper over the Bing API.
Bing provides a very simple Restful interface to their search engine
and provides results in JSON and XML interface.</p>

<p>With bingapi.py, we query the rest urls to get the JSON response,
which is parsed with simplejson.py. bingapi.py just adds simple niceties
like logging and error handling.</p>

<h3>Installing bingapi.py</h3>

<pre><code>easy_install bingapi
</code></pre>

<p>or Svn it from <code>https://svn.uswaretech.com/bingapi/</code></p>

<h3>Using bingapi.py</h3>

<p>To use this library, you need to have an Appid from Bing. You can get it from

http://www.bing.com/developers/createapp.aspx</p>

<p>The meat of bingapi.py is <code>talk_to_bing</code> function. It takes a query(eg. salsa)
and a sources(eg. web) and other optional parameters in extra_args
(eg. {&#8216;web.offset&#8217;: 40}) and returns the dictionary of Bing&#8217;s response.</p>

<p>eg</p>

<pre><code>In [2]: from bingapi import bingapi

In [3]: bing = bingapi.Bing('&lt;Your Appid&gt;')

In [4]: bing.talk_to_bing('salsa', sources='web')
Out[4]: 
..........

In [5]: bing.talk_to_bing('salsa', sources='web', extra_args={'web.offset':40})
Out[5]: 
..........
</code></pre>

<p>Class <code>Bing</code> also provides utility functions to do the various types of seraches
so you dont have to remember the source type.</p>

<p>The various functions available are,</p>

<pre><code>do_web_search
do_image_search
do_news_search
do_spell_search
do_related_search
do_phonebook_search
do_answers_search
</code></pre>

<p>All of them are used similarly.</p>

<pre><code>In [6]: bing.do_web_search('salsa')
Out[6]: 
..........

In [7]: bing.do_image_search('salsa')
Out[7]: 
..............

In [8]: bing.do_answers_search('what is salsa')
Out[8]: 
...............
</code></pre>

<p>If you want to use multiple sources in one call you can use <code>talk_to_bing</code>
directly as</p>

<pre><code>In [10]: bing.talk_to_bing(query='salsa', sources='web news')
Out[10]:
............
</code></pre>

<p>But, but.. Why bing? you ask. Well, other than the fact that bing search is indeed better in some areas, particularly multimedia, bing has fairer <a href="http://www.bing.com/community/blogs/developer/archive/2009/05/28/announcing-the-new-live-search-api-version-2-0-beta.aspx">usage quota and API restrictions</a>.</p>

<h3>Resources</h3>

<ul>
<li><a href="http://www.bing.com/developers/">http://www.bing.com/developers/</a></li>
<li><a href="http://pypi.python.org/pypi/bingapi/0.01">http://pypi.python.org/pypi/bingapi/0.01</a></li>
</ul>

<hr />

<p>Developing a search mashup? Bing API? <a href="http://uswaretech.com/blog/2008/04/new-tutorial-building-a-search-engine-with-appengine-and-yahoo/">Yahoo</a>, Google APIs? <a href="http://uswaretech.com/contact/">We can help</a>.</p>


<p>Related posts:<ol><li><a href='http://uswaretech.com/blog/2009/06/yahoo-boss-python-api/' rel='bookmark' title='Permanent Link: Yahoo BOSS python api'>Yahoo BOSS python api</a></li>
<li><a href='http://uswaretech.com/blog/2009/06/better-python-package-management-using-source-and-version-control-systems/' rel='bookmark' title='Permanent Link: Better Python package management using source and version control systems'>Better Python package management using source and version control systems</a></li>
<li><a href='http://uswaretech.com/blog/2009/03/finding-keywords-using-python/' rel='bookmark' title='Permanent Link: Finding keywords using Python'>Finding keywords using Python</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://uswaretech.com/blog/2009/06/bing-python-api/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
