A simple python wrapper for Google's Firebase REST API's.
Project description
Firebase REST API
A simple python wrapper for Google's Firebase REST API's.
Installation
pip install firebase-rest-api
Quick Start
In order to use this library, you first need to go through the following steps:
-
Select or create a Firebase project from Firebase Console.
-
Register an Web App.
Example Usage
# Import Firebase REST API library
import firebase
# Firebase configuration
config = {
"apiKey": "apiKey",
"authDomain": "projectId.firebaseapp.com",
"databaseURL": "https://databaseName.firebaseio.com",
"projectId": "projectId",
"storageBucket": "projectId.appspot.com",
"messagingSenderId": "messagingSenderId",
"appId": "appId"
}
# Instantiates a Firebase app
app = firebase.initialize_app(config)
# Firebase Authentication
auth = app.auth()
# Create new user and sign in
auth.create_user_with_email_and_password(email, password)
user = auth.sign_in_with_email_and_password(email, password)
# Firebase Realtime Database
db = app.database()
# Data to save in database
data = {
"name": "Robert Downey Jr.",
"email": user.get('email')
}
# Store data to Firebase Database
db.child("users").push(data, user.get('idToken'))
# Firebase Storage
storage = app.storage()
# File to store in storage
file_path = 'static/img/example.png'
# Store file to Firebase Storage
storage.child(user.get('localId')).child('uploaded-picture.png').put(file_path, user.get('idToken'))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
firebase-rest-api-1.7.0.tar.gz
(47.8 kB
view details)
Built Distribution
File details
Details for the file firebase-rest-api-1.7.0.tar.gz
.
File metadata
- Download URL: firebase-rest-api-1.7.0.tar.gz
- Upload date:
- Size: 47.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ad41de9e4b6c9c7b66781dc42d1e1e5e381eb634bd0ec3700b8b316d9786814 |
|
MD5 | 32c4a16c7ba86ef0b1f22114da9e5496 |
|
BLAKE2b-256 | dec98a7752cc46e5f61e7dc98191a86b1c3af958f289b1c5431295c614679389 |
File details
Details for the file firebase_rest_api-1.7.0-py3-none-any.whl
.
File metadata
- Download URL: firebase_rest_api-1.7.0-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86edbe4cf2e95e78828526269e5df68dfab7eb0e948140cd3e5af1d9a943bb76 |
|
MD5 | 769ffa768e095950ac354a5b25dc0e87 |
|
BLAKE2b-256 | cc4c0e159496a7a118f0c338c3fde8afab91e5c1434f0e892fdb99644e09fc2e |