Kalyan Prusty
Kalyan Prusty

Reputation: 130

Upload Image file to Firebase in Python

I have tried so much but I'm unable to figure out why this the returned object imageBlob in my code is NoneType ? Please some body help me

My Code is

import firebase
from google.cloud import storage
from google.cloud.storage import client
import cv2

import firebase_admin
from firebase_admin import credentials
from firebase_admin import storage

currentImage = None
firebase = firebase.FirebaseApplication('https://auburnfirebase.firebaseio.com', None)

imageUrl = "imageurlkalyan.com"
firebase.delete('/image',None)
result = firebase.post('/image',imageUrl)

cred = credentials.Certificate('storageServiceAuburn.json')
firebase_admin.initialize_app(cred, {
    'storageBucket': 'auburnfirebase.appspot.com'
})

bucket = storage.bucket()
print bucket

img = cv2.imread('photo.png')
#cv2.imshow('image',img)

imageBlob = bucket.get_blob('C:/Python27/photo.png')
print imageBlob

Thanks in advance

Upvotes: 0

Views: 8568

Answers (1)

Kalyan Prusty
Kalyan Prusty

Reputation: 130

Yes! i got that

imageBlob = bucket.blob(os.path.basename('C:/Python27/photo.png'))

only by changing this much of code it worked

Upvotes: 1

Related Questions