[英]Why Google Cloud Storage quickstart.py works on google cloud shell but not on Google App Engine?
Google Cloud Storage quickstart.py可在Google Cloud Shell上運行,但不能在Google App Engine上運行
quickstart.py
def run_quickstart():
# [START storage_quickstart]
# Imports the Google Cloud client library
from google.cloud import storage
# Instantiates a client
storage_client = storage.Client()
bucket_name = 'mygoolgeappproject.appspot.com'
bucket = storage_client.get_bucket(bucket_name)
blobs = bucket.list_blobs()`enter code here`
for blob in blobs:
print(blob.name)
# The name for the new bucket
#bucket_name = 'mygoolgeappproject.appspot.com'
# Creates the new bucket
#bucket = storage_client.create_bucket(bucket_name)
#print('Bucket {} created.'.format(bucket.name))
# [END storage_quickstart]
if __name__ == '__main__':
run_quickstart()
您不能直接將GAS應用程序直接運行諸如quickstart.py
類的普通python腳本。 不同目的的不同工具。
您需要一個基本的GAE應用框架。 您可以在Hello World代碼審查中找到示例框架。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.