首页 > 解决方案 > 谷歌 API。导入的库没有属性

问题描述

嗨,希望任何人都可以提供帮助 =) 我正在尝试使用 Google API,并且构建实例没有属性。甚至来自 Google 的示例项目也不起作用: https ://developers.google.com/calendar/quickstart/python

我试图重新安装库并使用以下命令强制重新安装:“pip install --force-reinstall google-api-python-client”。

来自另一个谷歌网站的代码也不起作用:

from googleapiclient.discovery import build

API_KEY='my_apiKey'

GPLUS = build('plus', 'v1', developerKey=API_KEY)
TMPL = '''
    User: %s
    Date: %s
    Post: %s
'''
items = GPLUS.event()  # AttributeError: 'Resource' object has no attribute 'event'

标签: pythonattributesmembergoogle-api-client

解决方案


经过更多测试后,我可以验证是否存在属性,因为代码正在运行,但是 VS Code 中的 pylint 没有找到属性,因此将它们标记为不存在。

我不知道为什么会这样。


推荐阅读