如何从Raspberry Pi将图像上传到Firebase? [英] How to upload images to Firebase from Raspberry Pi?

查看:80
本文介绍了如何从Raspberry Pi将图像上传到Firebase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用Python将图像上传到Firebase.如果有人可以提供摘要,那将是很大的帮助.

I am having trouble uploading images to Firebase using Python. it would be great help if someone can provide a snippet.

推荐答案

看看 gcloud-python ,或我们的有关在Firebase Storage中使用GCS API的文档.从这些文档中:

Take a look at gcloud-python, or our docs on using GCS APIs with Firebase Storage. From those docs:

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

这篇关于如何从Raspberry Pi将图像上传到Firebase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆