gpt4 book ai didi

python - Google 相册 API - 新版本?

转载 作者:行者123 更新时间:2023-12-04 16:38:06 28 4
gpt4 key购买 nike

我正在编写一个程序来在本地备份我的 Google 相册库,上周代码运行良好,但在过去的几天里,我反复从 API 客户端收到错误消息,说“photoslibrary v1”不存在在 Google 的 API 库中。文档根本没有改变 - 是谷歌有问题还是我有问题?

from googleapiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools

class Photos:
def __init__(self):
self.SCOPE = "https://www.googleapis.com/auth/photoslibrary"
self.CLIENT_SECRET = "client_id.json"
self.store = file.Storage("storage.json")
self.credentials = self.store.get()
if not self.credentials or self.credentials.invalid:
self.flow = client.flow_from_clientsecrets("client_id.json", self.SCOPE)
self.credentials = tools.run_flow(self.flow, self.store)
self.PHOTOS = discovery.build("photoslibrary", "v1", http=self.credentials.authorize(Http()))

photos = Photos()

googleapiclient.errors.UnknownApiNameOrVersion: name: photoslibrary version: v1

最佳答案

尝试添加参数 static_discovery=False

self.PHOTOS = discovery.build("photoslibrary", "v1", http=self.credentials.authorize(Http()),static_discovery=False)

关于python - Google 相册 API - 新版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66689941/

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