gpt4 book ai didi

python - 无法访问 mqlread API

转载 作者:行者123 更新时间:2023-12-01 03:56:01 25 4
gpt4 key购买 nike

我尝试从 Freebase 访问 mqlread API,但收到“Not Found”404:

api_key = open("freebaseApiKey").read()
mqlread_url = 'https://www.googleapis.com/freebase/v1/mqlread'
mql_query = '[{"mid": null,"name": null, "type": "/location/statistical_region","limit": 100}]'
cursor = ""

topicService_url = 'https://www.googleapis.com/freebase/v1/topic'
params = {
'key': api_key,
'filter': '/location/statistical_region',
'limit': 0
}

for i in xrange(1000):
mql_url = mqlread_url + '?query=' + mql_query + "&cursor=" + cursor
print mql_url
statisticalRegionsResult = json.loads(urllib.urlopen(mql_url).read())
....

显然,当我运行 python 文件时,我得到:

https://www.googleapis.com/freebase/v1/mqlread?query=[{"mid": null,"name": null, "type": "/location/statistical_region","limit": 100}]&cursor=
Traceback (most recent call last):
File "[Filepath]...FreeBaseDownload.py", line 37, in <module>
statisticalRegionsResult = json.loads(urllib.urlopen(mql_url).read())
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 338, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

我的 API 做错了什么?我读过有关 mqlread 被弃用的内容,我在 Freebase 中获取所有统计区域(中区)的任务有何相似之处?

最佳答案

一年多前它已被弃用。最终于5月2日被关闭。

https://groups.google.com/forum/#!topic/freebase-discuss/WEnyO8f7xOQ

现在此信息的唯一来源是 Freebase 数据转储。

https://developers.google.com/freebase/#freebase-rdf-dumps

关于python - 无法访问 mqlread API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37460817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com