简体   繁体   English

如何使用python从firebase存储文件夹下载图像?

[英]How do I download image from firebase storage folder with python?

I want to download image from firebase storage which the resouce folder我想从资源文件夹的 firebase 存储下载图像

1

can anyone teach me how to do?谁能教我怎么做?

my english is not good forgive me我的英语不好请原谅我

This code will help you download any image in Firebase, you will find in your local folder as "img.png"此代码将帮助您下载 Firebase 中的任何图像,您将在本地文件夹中找到“img.png”

The credentials.json should be in the same folder you run this code in and you can retrieve it from Firebase, its particular to your account credentials.json 应该在您运行此代码的同一文件夹中,您可以从 Firebase 中检索它,它特定于您的帐户

In my case my storage bucket is called 'aisparkdev-tinder.appspot.com'就我而言,我的存储桶称为“aisparkdev-tinder.appspot.com”

When generating the blob variable, the string is just the path to your image.生成 blob 变量时,字符串只是图像的路径。

import urllib
import firebase_admin
from firebase_admin import credentials
from firebase_admin import storage
cred = credentials.Certificate("credentials.json")

    # Initialize the app with a service account, granting admin privileges
appF = firebase_admin.initialize_app(cred, 
                                    {'storageBucket': 'aisparkdev-tinder.appspot.com',}, 
                                    name='storage')

bucket = storage.bucket(app=appF)

blob = bucket.blob("profileImages/"+profilePic+".jpg")
urllib.request.urlretrieve(blob.generate_signed_url(datetime.timedelta(seconds=300), method='GET'), ".\\img.png")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用python请求包从oracle云存储经典容器中下载文件夹的内容? - How do I download contents of a folder from oracle cloud storage classic container using the requests package for python? 如何使用 python 从 firebase 下载文件夹? - How to download a folder from firebase with python? 如何从 URL 将图像下载到特定文件夹中 - How do i download a image from a URL into a specific folder 使用 python 从 Firebase 存储下载文件链接 - Download files link from Firebase storage with python 如何从文件夹 python 中获取随机图像 - How do i get a random image from a folder python 我需要从 URL 下载图像并保存到 python 3.7 中的文件夹中 - I need to download the image from URL and save into the folder in python 3.7 如何使用Python从Firebase存储中检索图像? - How to retrieve image from Firebase Storage using Python? 如何使用 python 从 Google firebase 存储中删除图像文件 - How to delete a image file from Google firebase Storage using python 如何使用 firebase_admin 从 python 中的 firebase 存储中下载文件 - How to download file from firebase storage in python using firebase_admin Python:如何从 Google Drive 下载整个文件夹 - Python: How do download entire folder from Google Drive
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM