Fetch data from python

203 views
Skip to first unread message

Marcio Valenzuela

unread,
Sep 27, 2016, 10:58:41 AM9/27/16
to Firebase Google Group
I have this simple code for fetching from java script:

<script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "mykey",
authDomain: "myapp.firebaseapp.com",
databaseURL: "https://myapp.firebaseio.com",
storageBucket: "myapp.appspot.com",
messagingSenderId: "my Id"
firebase.initializeApp(config);
</script>
<script>
//6 firebase support
//firebase.database.enableLogging(true);
console.log("test3");
var messageRef = firebase.database().ref('timeoff/');
messageRef.on('value', function(snapshot) {
window.alert(snapshot.val());
});
}
</script>

How so I translate this to python so it can access the rest api directly?

Jacob Wenger

unread,
Sep 27, 2016, 11:10:41 AM9/27/16
to fireba...@googlegroups.com
There is no official Python SDK for Firebase, but I would suggest trying out the third party Pyrebase library.

Cheers,
Jacob


--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/b3a1255e-1384-4bd7-a732-bb86433bcdc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marcio Valenzuela

unread,
Sep 27, 2016, 6:18:07 PM9/27/16
to Firebase Google Group
I don't want to use a third party wrapper because I tried ozgurs and there seems to be an issue currently with it. I'd like to try and fetch the data directly from the rest api.

Kato Richardson

unread,
Sep 27, 2016, 6:46:50 PM9/27/16
to Firebase Google Group
Hi Marcio,

The guide on using the REST API is here. It covers reads, writes, queries, and the (limited) streaming capabilities.

☼, Kato

On Tue, Sep 27, 2016 at 12:14 PM, Marcio Valenzuela <quiq...@gmail.com> wrote:
I don't want to use a third party wrapper because I tried ozgurs and there seems to be an issue currently with it.  I'd like to try and fetch the data directly from the rest api.
--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Marcio Valenzuela

unread,
Sep 28, 2016, 10:37:18 AM9/28/16
to Firebase Google Group
Yeah, I've seen that it does. But that hasn't been clear enough for me. I'm sorry, I'm not that good a programmer.

I need to build a python script to access the data. I'm working in python because I will run it off a Raspberry pi which runs a python script that controls hardware.

So I'm currently at:

from firebase import firebase

firebase = firebase.FirebaseApplication("myhttppsapp")

I know I can either add authentication by:

firebase = firebase.FirebaseApplication("myhttppsapp", authentication=aAuth

Where I have Previously defined:

auth = firebase.FirebaseAuthentication(secret,email) or something like that.

Or I can write a Def to return a user token.

I'm looking for an example that I can pick apart.

Can you point me to a python example?












Kato Richardson

unread,
Sep 28, 2016, 12:14:12 PM9/28/16
to Firebase Google Group
Marcio,

I can't offer any better examples that Jacob has. The OSS lib he suggested does exactly these things. Dig in.

☼, Kato


--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages