python - Error on using pybing -


i have written script generate urls using pybing.

from pybing import bing bing = bing('mykey') response = bing.search_web('python bing') print response['searchresponse']['web']['total'] results = response['searchresponse']['web']['results'] print len(results) result in results[:3]:      print repr(result['title']) 

the error is

traceback (most recent call last):   file "c:\python27\project\yql.py", line 4, in <module>     print response['searchresponse']['web']['total'] keyerror: 'web' 

on printing response variable get

{u'searchresponse': {u'errors': [{u'helpurl': u'http://msdn.microsoft.com/en- us/library/dd251042.aspx', u'message': u'parameter has invalid value.', u'code': 1002,  u'parameter': u'searchrequest.appid', u'value': u'mykey'}], u'query': {u'searchterms': u'pyt'}, u'version': u'2.0'}} 

how should fix code.

it looks bing search api changed. unfortunately, pybing not seem updated (yet) new api, should pretty easy use bing json api directly.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -