【发布时间】:2021-10-11 08:07:20
【问题描述】:
我采用了这个code,它只需稍加修改即可工作(添加static_discovery=False):
service = build('photoslibrary', 'v1', credentials = creds, static_discovery=False)
但这只会读取数据。 我想创建一个相册。 所以,我补充说:
response_create_album = service.albums().create(body={'album':{'title':'helloworld'}}).execute()
给了我这个消息没有用:
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://photoslibrary.googleapis.com/v1/albums?alt=json returned "Request had insufficient authentication scopes."
我使用了不同的范围:
'https://www.googleapis.com/auth/photoslibrary.readonly'
'https://www.googleapis.com/auth/photoslibrary.edit'
'https://www.googleapis.com/auth/photoslibrary.edit.appcreateddata'
'https://www.googleapis.com/auth/photoslibrary.appendonly'
没有任何效果。
我最终怎样才能成功?
【问题讨论】:
标签: python-3.x google-api-python-client google-developers-console google-photos-api