ozgur/python-firebase

noob questions

Opened this issue · 0 comments

I'm very new to firebase, and I basically want to populate a base from Python,
so I wrote the following code following the tutorial:

import json, multiprocessing
from firebase import firebase

multiprocessing.freeze_support() #prevents crashes in debugger/win

ref = firebase.FirebaseApplication('https://mybasehere.firebaseio.com/', authentication=None)

result = ref.get('/test', None)
print result

result = ref.post('/test', {'test4':'posted'})
print result

which starts by giving the expected result (I entered some data through firebase's dashboard):

{u'test1': 1, u'test3': {u'test32': u'another one', u'test31': u'subtest'}, u'test2': u'test2'}
{u'name': u'-JcxGMqR_yyfWJVLfN8G'}

but then the program pauses a few seconds and outputs 2x5 more lines :

{u'test1': 1, u'test3': {u'test32': u'another one', u'test31': u'subtest'}, u'test2': u'test2', u'-JcxGMqR_yyfWJVLfN8G': {u'test4': u'posted'}}
{u'test1': 1, u'test3': {u'test32': u'another one', u'test31': u'subtest'}, u'test2': u'test2', u'-JcxGMqR_yyfWJVLfN8G': {u'test4': u'posted'}}
{u'test1': 1, u'test3': {u'test32': u'another one', u'test31': u'subtest'}, u'test2': u'test2', u'-JcxGMqR_yyfWJVLfN8G': {u'test4': u'posted'}}
{u'test1': 1, u'test3': {u'test32': u'another one', u'test31': u'subtest'}, u'test2': u'test2', u'-JcxGMqR_yyfWJVLfN8G': {u'test4': u'posted'}}
{u'test1': 1, u'test3': {u'test32': u'another one', u'test31': u'subtest'}, u'test2': u'test2', u'-JcxGMqR_yyfWJVLfN8G': {u'test4': u'posted'}}
{u'name': u'-JcxGPf-zpGnnGZR35iW'}
{u'name': u'-JcxGPfgPhD4XXK302dn'}
{u'name': u'-JcxGPfr_eaeLRhaHyBr'}
{u'name': u'-JcxGPg7vijAUTv1HbxX'}
{u'name': u'-JcxGPgvRqFXM69hM_qT'}

and I see 6 new records in firebase's dashboard instead of a single 'test4' as expected.
What happened ? and how can I write key='test4' with value='posted' simply in 'test' ?