有没有办法在没有第三方应用程序的情况下从Google Cloud Storage检索数据?
我尝试使用python,但收到以下错误代码。
import json
from httplib2 import Http
from oauth2client.client import SignedJwtAssertionCredentials
from apiclient.discovery import build
# Change these variables to fit your case
client_email = *******.iam.gserviceaccount.com
json_file = C:******
cloud_storage_bucket = pubsite_prod_rev_********
report_to_download = installs_********_201901_app_version
private_key = json.loads(open(json_file).read())[my private key here]
credentials = SignedJwtAssertionCredentials(*******@gmail.com,my_private_key here),
storage = build('storage', 'v1', http=credentials.authorize(Http()))
print storage.objects().get()
bucket=cloud_storage_bucket
object=report_to_download).execute()
Python 抛出此错误:
编译单个语句时发现多个语句
错误消息来自不正确的 Python 格式、语法或缩进。
查看您要执行的最后一个语句,bucket
和object
应该在 get(( 中。
print storage.objects().get(
bucket=cloud_storage_bucket,
object=report_to_download).execute()