python“资源”对象中的Freebase API没有属性“ mqlread”
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了python“资源”对象中的Freebase API没有属性“ mqlread”,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1693字,纯文字阅读大概需要3分钟。
内容图文
![python“资源”对象中的Freebase API没有属性“ mqlread”](/upload/InfoBanner/zyjiaocheng/659/44a8c194e63646be9896ff8036351e9d.jpg)
我有一个脚本可以读取Freebase数据,但是它突然停止工作.它输出以下错误:
AttributeError: 'Resource' object has no attribute 'mqlread'
所以我在Google documentation中尝试了示例代码,
from apiclient import discovery
from apiclient import model
import json
DEVELOPER_KEY = 'my_key'
model.JsonModel.alt_param = ""
freebase = discovery.build('freebase', 'v1', developerKey=DEVELOPER_KEY)
query = [{'id': None, 'name': None, 'type': '/film/film'}]
def do_query(cursor=""):
response = json.loads(freebase.mqlread(query=json.dumps(query), cursor=cursor).execute())
for item in response['result']:
print item['name']
return response.get("cursor")
cursor = do_query()
while(cursor):
cursor = do_query(cursor)
而且我得到了同样的错误… mqlread方法消失了,当我执行dir(freebase)时,我得到了这个:
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getstate__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_add_basic_methods', '_add_nested_resources', '_add_next_methods', '_baseUrl', '_developerKey', '_dynamic_attrs', '_http', '_model', '_requestBuilder', '_resourceDesc', '_rootDesc', '_schema', '_set_dynamic_attr', '_set_service_methods', u'reconcile', u'search', u'search_media']
他们是否在新版本的API客户端中删除了此功能?我正在使用google-api-python-client的1.2版
解决方法:
对于那个很抱歉.这是暂时的问题,无法从Google API发现服务中看到mqlread服务.该API本身仍然可以从https://www.googleapis.com/freebase/v1/mqlread访问,但是Google客户端库依赖于发现服务将mqlread公开为一种方法.我们的工程团队正在研究修补程序,并且应该很快推出.当他们这样做时,我会进行更新.
内容总结
以上是互联网集市为您收集整理的python“资源”对象中的Freebase API没有属性“ mqlread”全部内容,希望文章能够帮你解决python“资源”对象中的Freebase API没有属性“ mqlread”所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。