python - 使用标准 Google API Python 库时的 httplib.ResponseNotReady

标签 python google-app-engine freebase google-api-python-client

我正在尝试运行 Google API Python 库以使用 freebase API。 我按照此链接中的教程进行操作。

https://developers.google.com/api-client-library/python/start/get_started

当我运行这段代码时。

import freebase
query = {
 "id" :   "/en/the_beatles",
 "type" : "/music/artist",
 "album" : [{
"name" :         None,
"release_date" : None,
"track": {
    "return" : "count"
},
"sort" : "release_date"
}]
}
freebase.mqlread(query)

我收到这个错误

httplib.ResponseNotReady

有人可以帮我解决这个问题吗?

提前致谢

最佳答案

google-api-python-client 库中没有任何内容支持“导入 freebase”。看来您正在使用已弃用的 freebase 库 https://code.google.com/p/freebase-python/ .

我建议从使用 Quickstart for Freebase 创建的框架应用程序开始,然后添加以下Python代码进行查询:

import json

query = {
  "id" :   "/en/the_beatles",
  "type" : "/music/artist",
  "album" : [{
    "name" :         None,
    "release_date" : None,
    "sort" : "release_date",
  }]
}    

pprint.pprint(service.mqlread(query=json.dumps(query)).execute())

关于python - 使用标准 Google API Python 库时的 httplib.ResponseNotReady,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17415211/

相关文章:

Python 将 True False 矩阵转换为图像

python - 如何修复不满足 biner 约束的 PuLP VRP 模型

Freebase币种查询

python - 使用请求将 JSON 对象传递到 url

python - 使用 TwitterAPI Python 库,当您进行搜索时可以按语言进行过滤吗?

python - 如何使用 groupby 推断缺失值 - Python?

java - WebRTC 服务器端信令

python - 避免或处理 "BadRequestError: The requested query has expired."?

python - Google App Engine - 将 Search API Python 与列表字段一起使用

google-api - 如何使用 YouTube Data API v3 中的 `relevantTopicIds`?