Last active
September 4, 2022 22:24
-
-
Save rbtrsv/501dd2d1567b9b3dcb2b68c2a4e87a20 to your computer and use it in GitHub Desktop.
Revisions
-
rbtrsv revised this gist
Sep 4, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ cred = credentials.Certificate('/Users/your.name/yada-yada-firebase-adminsdk.json') firebase_admin.initialize_app(cred, { 'storageBucket': '<yourstorage>.appspot.com' }) bucket = storage.bucket() -
rbtrsv created this gist
Sep 4, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ import sys import requests import firebase_admin from firebase_admin import credentials from firebase_admin import storage # The url is passed as an argument image_url = sys.argv[1] cred = credentials.Certificate('/Users/your.name/yada-yada-firebase-adminsdk.json') firebase_admin.initialize_app(cred, { 'storageBucket': '<mysuperstorage>.appspot.com' }) bucket = storage.bucket() image_data = requests.get(image_url).content blob = bucket.blob('image_name.jpg') blob.upload_from_string( image_data, content_type='image/jpg' ) print(blob.public_url)