Python Firebase替换自动生成的密钥

时间:2017-03-29 02:55:11

标签: python firebase firebase-realtime-database

我使用Python向Firebase添加了一些数据,我想使用我生成的MD5字符串作为每条记录的唯一索引。
Firebase中自动生成的密钥类似于“-KgMvzKKxVgj4RKN-3x5”。是否可以用Python替换它的价值?我知道如何用Javascript做到这一点。请帮忙......提前致谢!

f = firebase.FirebaseApplication('https://xxxxx.firebaseio.com')
f.post('meeting/',
    {
     "MD5index":MD5String,
     "title": title, 
     "date": date,
     "time": time,
     "location": location
     })

1 个答案:

答案 0 :(得分:1)

确实如此。只需使用put代替post

f = firebase.FirebaseApplication('https://xxxxx.firebaseio.com')
f.put('meeting/mymeetingkey',
    {
     "MD5index":MD5String,
     "title": title, 
     "date": date,
     "time": time,
     "location": location
     })