I was wondering how could I get the url from the file I am uploading to the firebase storage? Here is my code:
import firebase_admin
from firebase_admin import credentials, firestore, storage
cred=credentials.Certificate('/serviceAccountKey.json')
firebase_admin.initialize_app(cred, {
'storageBucket': <my_bucket_name>
})
db = firestore.client()
bucket = storage.bucket()
blob = bucket.blob('image.jpg')
blob.upload_from_filename('/image.jpg')
#here I'd like to have url of file I uploaded
print(blob.<url>)
Thanks in advance.
You should use the following code:
blob.upload_from_filename(BLOB_PATH)
blob.make_public()
print(blob.public_url)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With