首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AttributeError:在firebase python上,模块“”firebase.firebase“”没有属性“”post“”

AttributeError:在firebase python上,模块“”firebase.firebase“”没有属性“”post“”
EN

Stack Overflow用户
提问于 2018-03-18 08:56:05
回答 1查看 2.2K关注 0票数 1

我正在尝试将数据添加到我的firebase实时数据库中。我使用下面的代码:

代码语言:javascript
复制
from firebase import firebase

class Sugar:

    firebase = firebase.FirebaseApplication('https://diatrack-48525.firebaseio.com/',authentication=None)
    result = firebase.post('/Sugar type',{'name':name,'gender':gender,'age': age,'sugartype':'Type 1'})

它显示以下错误:

代码语言:javascript
复制
result = firebase.post('/Sugar type',{'name':name,'gender':gender,'age': age,'sugartype':'Type 1'})
AttributeError: module 'firebase.firebase' has no attribute 'post'
EN

回答 1

Stack Overflow用户

发布于 2018-03-18 09:10:13

这可能是因为您在一个类作用域中,并且重复的firebase名称(模块和变量)不能正常工作。这行得通吗?

代码语言:javascript
复制
from firebase import firebase

class Sugar:

    firebase_app = firebase.FirebaseApplication('https://diatrack-48525.firebaseio.com/',authentication=None)
    result = firebase_app('/Sugar type',{'name':name,'gender':gender,'age': age,'sugartype':'Type 1'})
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49343473

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档