Skip to main content

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.


Installation

pip install async-firebase-rest-api

Quick Start

In order to use this library, you first need to go through the following steps:

  1. Select or create a Firebase project from Firebase Console.

  2. 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

async_firebase_rest_api-2.0.1.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

async_firebase_rest_api-2.0.1-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file async_firebase_rest_api-2.0.1.tar.gz.

File metadata

File hashes

Hashes for async_firebase_rest_api-2.0.1.tar.gz
Algorithm Hash digest
SHA256 b4aa2353bc4c01f19e51e9da88062dc10955267285b7b9859deae0470f3fe5c5
MD5 f8d19e6450a30864c4be0e92bd3a46a8
BLAKE2b-256 806c54ee9d889e3128b7b7329e4e7f0947ca35c3fc7a2cbcc8293acc80b2afcf

See more details on using hashes here.

File details

Details for the file async_firebase_rest_api-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for async_firebase_rest_api-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57c8fc78b90c8af36c88c40645a3426eb1d3e15322cb727c7616b376fe453240
MD5 efd2a6a968daa383671bacd7571aa0eb
BLAKE2b-256 07c4b1a447efff2dc96d6c20c15337c5c3b1b9c4078628d678e955534e323e71

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page