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": await 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
File details
Details for the file async_firebase_rest_api-2.1.0.tar.gz
.
File metadata
- Download URL: async_firebase_rest_api-2.1.0.tar.gz
- Upload date:
- Size: 49.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a001205b056e75c8497dfe95b1049d2431328baae732d27a0197668335d50bdd |
|
MD5 | 8374dfafa0f89d7f6d16c5006bf4faf8 |
|
BLAKE2b-256 | adeda7fb11caa4abb0ed84b6b68151871f200dc29cc8c073b7320c2400f9151d |
File details
Details for the file async_firebase_rest_api-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: async_firebase_rest_api-2.1.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecf489c539db01fe95da1d1242252161277d892cb1eff5d11f9f50dd469b06a4 |
|
MD5 | 9e8198a6046ff928613731c88037f688 |
|
BLAKE2b-256 | d674d4fd5a363fb29ddf3f681654948632e86de78a8597c2907e4189230433d1 |