Ich versuche, Daten auf Firebase von Python (2.7) zu erwerben.Firebase-Benutzerauthentifizierung in Python
Hier sind meine Regeln (auf firebseio.com):
{
"rules": {
"user": {
"$uid": {
".read": "auth != null && auth.uid == $uid",
".write": "auth != null && auth.uid == $uid"
}
}
}
}
Hier ist ein Screenshot von meinem databse:
Und schließlich mein Python-Code:
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
Jetzt kann ich nicht herausfinden, wie man Daten erhält und Daten von und zu Firebase sendet. Ich habe versucht die Linie useing: result = firebase.get('/users', None, {'print': 'pretty'})
, aber es gibt mir diese Fehlermeldung:
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',))
Kann mir jemand mit einem funktionierenden Code zur Verfügung stellen?
Vielen Dank im Voraus,
Zvi Karp
Was passiert, wenn ich keinen DSN verwende? – marciokoko