Change variable ID in firebase with the Python Firebase library

0

I would like to know how I can enter data to firebase so that the structure is for example like this:

/Usuarios/Administradores/Angel/Nombre

and not this:

/Usuarios/Administradores/-LGze8xg3oWiYgzWi6F1/Angel2/Nombre

that is, I do not want this: -LGze8xg3oWiYgzWi6F1 is added to the hierarchy.

this is the code I use:

from firebase import firebase


s = "hola que hace"
firebase = firebase.FirebaseApplication('https://new1-3b819.firebaseio.com/')

result = firebase.post('/Usuarios/Administradores',{'Angel2':{'Nombre':s}})
#result = firebase.get('/Usuarios/Administradores/Angel1',None)
print(result)

but with this code it generates the: -LGze8xg3oWiYgzWi6F1

    
asked by Revsky01 10.07.2018 в 01:46
source

1 answer

0

You could access the route directly with the method put and from there add the properties you want, for example:

result = firebase.put('/usuarios/administradores/javier', {'nombre': 'Javier'})

With put you can write or replace data in a defined path. On the other hand, with the method post a new list is generated with a unique key.

    
answered by 10.07.2018 / 06:31
source