Python Firebase替换自动生成的密钥

2024-06-28 20:05:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我用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
     })

Tags: 数据字符串httpsdatetimetitle记录密钥
1条回答
网友
1楼 · 发布于 2024-06-28 20:05:37

是的。只需使用put而不是post

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

相关问题 更多 >