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.2.0.tar.gz
.
File metadata
- Download URL: async_firebase_rest_api-2.2.0.tar.gz
- Upload date:
- Size: 50.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa2e6e6aa4d25ce97201cae44408c732f32cfc35bce9ddd77057521f6309dcb |
|
MD5 | 7007acc9498164745d73c511ce7fce66 |
|
BLAKE2b-256 | dda8392b95c56242ed1c257086d921f54dbaa8b2fedef18a44befa1974970c44 |
File details
Details for the file async_firebase_rest_api-2.2.0-py3-none-any.whl
.
File metadata
- Download URL: async_firebase_rest_api-2.2.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57d0196d15a1a064100136aa2a544b171e04bbd95c619d8a301ecbec7fb3b60d |
|
MD5 | 35179499df0ece25f1a877301dceb1ff |
|
BLAKE2b-256 | fb42fa78700ba0490ee85a8ba1c373ad6163ca33bfe49722c626dd97fd990bdb |