我使用这个endpoint:谷歌云存储提供了 '权限不足'
get_media(bucket=*, object=*, ifGenerationNotMatch=None, generation=None, ifMetagenerationMatch=None, ifGenerationMatch=None, ifMetagenerationNotMatch=None, projection=None)
它给我的错误:
apiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/storage/v1/b/my-logs/o/clickstream.1413365729497.log?alt=json returned "Insufficient Permission">
代码:
service = build('storage', 'v1')
contents = service.objects().get(bucket=item['bucket'], object=item['name']).execute(http=http)
的item
来自先前(成功)的buckets.list
呼叫。这就是为什么服务帐户的权限错误非常奇怪。
这是目前在我的本地和我的身份验证:
with open(FILE_KEY, 'rb') as f:
key = f.read()
credentials = SignedJwtAssertionCredentials(
SERVICE_EMAIL_ADDRESS,
key,
scope='https://www.googleapis.com/auth/devstorage.full_control',
)
http = httplib2.Http()
http = credentials.authorize(http)
的对象(后来我上传了新的测试对象),都以默认的ACL权限创建。为什么这对服务帐户无法检索文件内容?
对不起,我很困惑。我看到了对service.objects.get()的调用,但我也看到了对service.objects()。get_media()的调用。哪个失败? – 2014-11-04 18:58:09