让我们假设我在项目X中有谷歌云存储桶,并且希望从项目Y上部署的代码(Python)项目X中的桶中上传对象。 项目X和Y都使用相同的凭据(登录ID)。从其他项目使用python访问谷歌云存储桶
使用OAuth2.0或其他建议可以实现吗? 我已尝试使用服务帐户,AppAssertionCredentials & OAuth2DecoratorFromClientSecrets但失败。
credentials = GoogleCredentials.get_application_default()
service = discovery.build('storage', 'v1', credentials=credentials)
req = service.objects().insert(
bucket=bucket_name,
name=fileName,
media_body=media)