0

Currently, I have this python script running:

import pyrebase

# Config the firebase
# Create a stream
# Attatch the streamHandler
# Push the data to the firebase after analysis

config = {
  "apiKey": "Yl6***************OigD",
  "authDomain": "********.firebaseapp.com",
  "databaseURL": "https://****.firebaseio.com",
  "storageBucket": "*****.appspot.com",
  "serviceAccount": "/Users/ndh/Desktop/ConditioningMaintainanceAnalysis/**************.json"
}

firebase = pyrebase.initialize_app(config)
db = firebase.database()

This gives me following error:

  File "/Users/ndh/anaconda3/lib/python3.6/site-packages/requests_toolbelt/auth/guess.py", line 6, in <module>
    from . import _digest_auth_compat as auth_compat, http_proxy_digest

  File "/Users/ndh/anaconda3/lib/python3.6/site-packages/requests_toolbelt/auth/_digest_auth_compat.py", line 17, in <module>
    class _HTTPDigestAuth(requests.auth.HTTPDigestAuth):

AttributeError: module 'requests' has no attribute 'auth'

How can I resolve this error?

Joel
  • 1,564
  • 7
  • 12
  • 20
Dravidian
  • 9,945
  • 3
  • 34
  • 74
  • You are missing `auth = firebase.auth()` – stovfl Nov 14 '18 at 17:41
  • Where? I tried putting `auth = firebase.auth()` after `db = firebase.database()`, but same error. – Dravidian Nov 15 '18 at 05:20
  • Follow this pattern [Pyrebase Authentication](https://github.com/thisbejim/Pyrebase) or [client.utils.firebase.pyrebase.initialize_app](https://programtalk.com/python-examples/client.utils.firebase.pyrebase.initialize_app/). You need the `auth` reference to **sign in**. – stovfl Nov 15 '18 at 09:08

1 Answers1

0

This worked for me

from Pyrebase import pyrebase

#just see your pyrebase lib in C:\Users\Agil\AppData\Local\Programs\Python\Python39\Lib\site-packages\Pyrebase

or default pyrebase library C:\Users\Agil\AppData\Local\Programs\Python\Python39\Lib\site-packages\Pyrebase-master

use

from Pyrebase-master import pyrebase
Roshin Raphel
  • 2,612
  • 4
  • 22
  • 40