Queries with firebase and python

0

I have the following problem:

This is my database in firebase:

path /Usuarios/Administradores/Angel,{'Nombre':'Angel'} create directly within firebase.

However, the other 3 believe them from the following code:

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/Angel2','Nombre')
print(result)

the duas are the following:

1.- Because firebase generates random variables to my other fields (-LGzdj ....) and how can I prevent it from doing so, so that my data is saved as the route I made inside the firebase.

2.- When trying to recover the data with:

result = firebase.get('/Usuarios/Administradores/Angel','Nombre')

Print the result, but when you change it to for example Angel2 or Angel1 only prints NONE

I hope you explained.

    
asked by Revsky01 09.07.2018 в 17:44
source

1 answer

1
  

TL; DR Usa put(url, key, data)

What you are saying is that if you use push it will 'push' the data in the node, as if that node were a list. That way you can push a lot of data in a single node, where you do not care about the ID of each data.

With put it's like doing a set . Whatever is written in the address will be replaced by the data you send.

firebase.put('/Usuarios/Administradores', 'User3', {'Nombre': 'Nery', 'Descripcion':'El mas mero macizo'})
    
answered by 14.07.2018 / 03:34
source