我无法使用Python将图片上传到Firebase。如果有人可以提供一个片段,那将会很有帮助。
答案 0 :(得分:1)
使用Firebase存储查看gcloud-python或our docs on using GCS APIs。从那些文档:
# 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()