nhorvath / Pyrebase4

A simple python wrapper for the Firebase API. ⛺
254 stars 63 forks source link

fix an attribute typo #26

Closed Ahmed-10 closed 3 years ago

Ahmed-10 commented 3 years ago

fix: "AttributeError: Storage object has no attribute bucket"

nhorvath commented 3 years ago

I think you probably just forgot to init storage with credentials. self.storage_bucket is just a string url. self.bucket is the actual bucket object.

    """ Storage Service """
    def __init__(self, credentials, storage_bucket, requests):
        self.storage_bucket = "https://firebasestorage.googleapis.com/v0/b/" + storage_bucket
        self.credentials = credentials
        self.requests = requests
        self.path = ""
        if credentials:
            client = storage.Client(credentials=credentials, project=storage_bucket)
-->         self.bucket = client.get_bucket(storage_bucket)
Ahmed-10 commented 3 years ago

So in order to use delete method, I need to get credentials with firebase_admin.credentials and initialize the storage with these credentials

nhorvath commented 3 years ago

Yes, delete requires credentials. You can put and download with just a token (or credentials) but list and delete require credentials.

On Sat, Jan 16, 2021 at 12:21 PM Ahmed Alaa notifications@github.com wrote:

So in order to use delete method, I need to get credentials with firebase_admin.credentials and initialize the storage with these credentials

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nhorvath/Pyrebase4/pull/26#issuecomment-761600648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABIJXH6AU4CE4ALXHB2FVTS2HDJVANCNFSM4WFMAFVA .

Ahmed-10 commented 3 years ago

Thank you for your explanation، If you don't mind I would love to add this to the documentation in the next couple of days.