如何使用 Python 的 Google API 客户端库 ( http://wiki.freebase.com/wiki/Google_API_Client_Libraries#Python )重现以下 MQL 查询
https://api.freebase.com/api/service/mqlread?queries={"q1":[{"name~=":"*doubt*","name": None,"type": "/media_common/quotation","author": [{"name": "William Shakespeare"}]}], "q2":[{"name~=":"*law*","name": None,"type": "/media_common/quotation","author": [{"name": "William Shakespeare"}]}]}
以下单个查询有效:
from apiclient import discovery
from apiclient import model
import json
from pprint import pprint
DEVELOPER_KEY = ''
model.JsonModel.alt_param = ""
freebase = discovery.build('freebase', 'v1', developerKey=DEVELOPER_KEY)
query = [{"name~=":"*doubt*","name": None,"type": "/media_common/quotation","author": [{"name": "William Shakespeare"}]}]
response = json.loads(freebase.mqlread(query=json.dumps(query)).execute())
pprint (response)
我看不到如何将参数“查询”更改为“查询”