firecall

A Python helper library for Firebase.

View the Project on GitHub GochoMugo/firecall

Getting Started

Import the firecall library

import firecall

Create a Firebase instance

my_firebase = firecall.Firebase("https://my-firebase_name.firebaseio.com")

While creating the Firebase instance, you might pass an access token to auth argument like shown below. The access token will persist across all transactions with the Firebase, unless you explicitly pass another access token to a method.

my_firebase = firecall.Firebase("https://my-firebase_name.firebaseio.com", auth="access_token_here")
# Ensure that you have defined the function you pass to "error=".

Firebase is now ready to be used. It’s time to conquer the World.

Basic Methods

These are the basic methods available to any Firebase

.root()

Get a Firebase reference to the root of the Firebase.

  • Requires No arguments.
  • Returns a String

Example:

print(my_firebase.root())

.name()

Get the last token of this location’s URL.

  • Requires No arguments
  • Returns a String

Example:

print(my_firebase.name())

.attr()

Returns a tuple containing some details of the Firebase.

  • Requires No arguments
  • Returns a tuple e.g (time_of_creation, url_of_firebase, auth_token)
print(my_firebase.attr())

.parent()

Get a Firebase instance with the parent Location as its URL

  • Requires No arguments
  • Returns a new Firebase Instance

Example:

new_parent = my_firebase.parent()

.child(**kwargs)

Get a Firebase instance with a child location as its URL

  • Requires:
    • point=”relative_URL_to_child”
  • Returns a Firebase Instance

Example:

new_child = my_firebase.child(point="/child")