We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I am new user to python and I am apologizing before hand if my question is stupid but would love to learn what I am doing wrong. Thanks so much
I downloaded and installed the module but when I run the code, I get the error below
TypeError Traceback (most recent call last) in () ----> 1 r = bingsearch.request("Python Software Foundation")
C:\Users\Documents\Python Scripts\bingsearch.py in request(query, *_params) 6 def request(query, *_params): 7 r = requests.get(URL % {'query': query}, auth=('', API_KEY)) ----> 8 return r.json['d']['results']
TypeError: 'NoneType' object has no attribute 'getitem'
The text was updated successfully, but these errors were encountered:
Seems there is a problem with the code. Maybe the Bing API has changed. Anyways, fix...
This is bingsearch.py, this is what it should be instead:
import urllib2 import requests
#URL = 'https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(query)s&$top=50&$format=json' URL = "https://api.datamarket.azure.com/Bing/Search/v1/Composite?Sources=%(source)s&Query=%(query)s&$top=50&$format=json" API_KEY = 'SECRET_API_KEY'
def request(query, **params): url = URL % {'source': urllib2.quote("'web'"), 'query': urllib2.quote("'"+query+"'")} r = requests.get(url, auth=('', API_KEY)) return r.json()['d']['results']
And your first result will be in: r = bingsearch.request("Python Software Foundation") print r[0]['Web'][0]['Description']
Sorry, something went wrong.
Awesome, thanks for replying! Appreciate it!
No branches or pull requests
Hi,
I am new user to python and I am apologizing before hand if my question is stupid but would love to learn what I am doing wrong. Thanks so much
I downloaded and installed the module but when I run the code, I get the error below
r = bingsearch.request("Python Software Foundation")
TypeError Traceback (most recent call last)
in ()
----> 1 r = bingsearch.request("Python Software Foundation")
C:\Users\Documents\Python Scripts\bingsearch.py in request(query, *_params)
6 def request(query, *_params):
7 r = requests.get(URL % {'query': query}, auth=('', API_KEY))
----> 8 return r.json['d']['results']
TypeError: 'NoneType' object has no attribute 'getitem'
The text was updated successfully, but these errors were encountered: