私はpython(2.7)からfirebaseのデータを取得しようとしています。PythonのFirebaseユーザ認証
そして最後に、私のpythonコード:
from firebase import firebase
from firebase.firebase import FirebaseApplication, FirebaseAuthentication
DSN = 'https://<my name>.localhost'
EMAIL = '[email protected]'
authentication = FirebaseAuthentication(EMAIL, True, True, extra={'id': '<the user id>'})
firebase = FirebaseApplication(DSN, authentication)
firebase.authentication = authentication
print authentication.extra
user = authentication.get_user()
print user.firebase_auth_token
ここ
{
"rules": {
"user": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid"
}
}
}
}
は私databseのスクリーンショットです:ここで
は(firebseio.com上)私のルールです
今、私はデータを取得し、firebaseとの間でデータをやりとりする方法を理解できません。 は、私はラインuseingしようと試み:result = firebase.get('/users', None, {'print': 'pretty'})
を、しかし、それは私に、このエラーを与える:
ConnectionError: HTTPSConnectionPool(host='<my name>.localhost', port=443): Max retries exceeded with url: /users/.json?print=pretty&auth=<the token code of the user> (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02A913B0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
誰でも作業コードを私に提供することはできますか?事前に
おかげで、
DSNを使用していない場合はどうなりますか? – marciokoko