An async python wrapper for Google's Firebase REST API's.
Project description
Async Firebase REST API
A simple python wrapper for Google's Firebase REST API's.
This package is an async fork of AsifArmanRahman/firebase-rest-api.
<img alt="Read the Docs" src="https://img.shields.io/readthedocs/async-firebase-rest-api?logo=Read%20the%20Docs&logoColor=white">
Installation
pip install async-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 Async 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
await auth.create_user_with_email_and_password(email, password)
user = await 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
await 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
await storage.child(user.get('localId')).child('uploaded-picture.png').put(file_path, user.get('idToken'))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for async_firebase_rest_api-2.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff1e53f65866a40a232625eff9fb065a35f58c10773dc3dc73713856b6f09693 |
|
MD5 | 76ee20f8d994c9c4462c50d0087b9e51 |
|
BLAKE2b-256 | 3dbad372bb8968b89fe62ee513ef69213bf31cb623e599c17f34cf13e037da63 |
Close
Hashes for async_firebase_rest_api-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb0cde5cfe9343d9c0996c36a6875c5e4021abb7c5c5752ef70a76bf4fecd86d |
|
MD5 | e49346ed3a0b60942ce6796b5a11e4d8 |
|
BLAKE2b-256 | 3aa4de538049aae0f4520112fbe263ef4e58fc7ec895e87f7f3eb5753a306597 |