我在使用Python上传图像到Firebase时遇到麻烦。这将是很大的帮助,如果有人可以提供一个片段。
看一下gcloud-python,或者我们关于在Firebase Storage中使用GCS api的文档。从这些文档:
# Import gcloud
from google.cloud import storage
# Enable Storage
client = storage.Client()
# Reference an existing bucket.
bucket = client.get_bucket('projectid.appspot.com')
# Upload a local file to a new file to be created in your bucket.
zebraBlob = bucket.get_blob('zebra.jpg')
zebraBlob.upload_from_filename(filename='/photos/zoo/zebra.jpg')
# Download a file from your bucket.
giraffeBlob = bucket.get_blob('giraffe.jpg')
giraffeBlob.download_as_string()