简体   繁体   中英

How to download with python to firebase storage image?

I could upload image to firebase storage with python. but I couldn't find how to download image with python to firebase storage.

This is similar question to How do I get url with token of uploaded file to firebase storage?

Change the security rule to that specific folder

  • Make sure you upload publically visible images to that specific folder
  • It doesn't require any access token to access such images
  • Capturing media token can only be done by the Client SDK and not available in the Admin SDK for firebase-admin python
rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
     // Explicitly define rules for the 'path/to/myfile/' pattern
    match /path/to/myfile/{allPaths}{
      allow  write: if request.auth != null; // Only Auth person can read
      allow  read: if request.auth == null; // Anyone can read
    }
    // This will be defined for everything else
    match /{allPaths=**} {
      allow  write: if request.auth != null; // Only auth person can write
      allow  read: if request.auth != null; // Only auth person can read
    }
  }
}

Sample python code

storageBucket='myapp.appspot.com'
bucket_path="path/to/myfile/temp.mp3"
firebase_storageURL = 'https://firebasestorage.googleapis.com/v0/b/{}/o/{}?alt=media'.format(storageBucket, bucket_path)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM