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.2.0.tar.gz (50.4 kB view details)

Uploaded Source

Built Distribution

async_firebase_rest_api-2.2.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for async_firebase_rest_api-2.2.0.tar.gz
Algorithm Hash digest
SHA256 1aa2e6e6aa4d25ce97201cae44408c732f32cfc35bce9ddd77057521f6309dcb
MD5 7007acc9498164745d73c511ce7fce66
BLAKE2b-256 dda8392b95c56242ed1c257086d921f54dbaa8b2fedef18a44befa1974970c44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for async_firebase_rest_api-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57d0196d15a1a064100136aa2a544b171e04bbd95c619d8a301ecbec7fb3b60d
MD5 35179499df0ece25f1a877301dceb1ff
BLAKE2b-256 fb42fa78700ba0490ee85a8ba1c373ad6163ca33bfe49722c626dd97fd990bdb

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