我已经写了这段代码;
import bingsearch
bingsearch.API_KEY='mykey'
r = bingsearch.request("JohnDalton")
r.status_code
r[0]['Description']
print r[0]['Url']
这是 bingsearch.py 文件
import requests
import urllib2
URL = 'https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/Web?Query=%(query)s&$top=50&$format=json'
API_KEY = 'mykey'
def request(query, **params):
r = requests.get(URL % {'query': query}, auth=('', API_KEY))
return r.json['d']['results']
正如我在标题中提到的,它给了我一个实例方法错误。我应该如何解决这个问题?