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
Post a Comment