Memo
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore, storage
cred = credentials.Certificate('your-cred.json')
firebase_admin.initialize_app(cred, {'storageBucket': '<bucket-name>'})
bucket = storage.bucket()
filename = 'image.png'
content_type = 'image/png'
blob = bucket.blob(filename)
with open(filename, 'rb') as f:
blob.upload_from_file(f, content_type=content_type)
Ref
Recommended Posts