Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 如何从Raspberry Pi向Firebase上传图像?_Python 2.7_Firebase_Raspberry Pi_Firebase Storage - Fatal编程技术网

Python 2.7 如何从Raspberry Pi向Firebase上传图像?

Python 2.7 如何从Raspberry Pi向Firebase上传图像?,python-2.7,firebase,raspberry-pi,firebase-storage,Python 2.7,Firebase,Raspberry Pi,Firebase Storage,我无法使用Python将图像上载到Firebase。如果有人能提供一个代码片段,那将非常有帮助。请看一看,或者使用Firebase存储。从这些文件中: # Import gcloud from google.cloud import storage # Enable Storage client = storage.Client() # Reference an existing bucket. bucket = client.get_bucket('projectid.appspot.co

我无法使用Python将图像上载到Firebase。如果有人能提供一个代码片段,那将非常有帮助。

请看一看,或者使用Firebase存储。从这些文件中:

# 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()