Metadata-Version: 2.1
Name: async-firebase-rest-api
Version: 2.0.0
Summary: An async python wrapper for Google's Firebase REST API's.
Keywords: firebase,firebase-auth,firebase-database,firebase-firestore,firebase-realtime-database,firebase-storage
Author-email: Asif Arman Rahman <asifarmanrahman@gmail.com>, Matias Kotlik <mdkotlik@gmail.com>
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: google-auth>=2.9.1
Requires-Dist: google-cloud-firestore>=2.5.3
Requires-Dist: google-cloud-storage>=2.0.0
Requires-Dist: pkce>=1.0.0
Requires-Dist: python_jwt>=3.3.2
Requires-Dist: requests>=2.27.1
Requires-Dist: six>=1.16.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: httpx-sse>=0.4.0
Requires-Dist: stamina>=24.2.0
Requires-Dist: Sphinx>=5.0.2 ; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.0.0 ; extra == "docs"
Requires-Dist: sphinx_design>=0.2.0 ; extra == "docs"
Requires-Dist: toml>=0.10.2 ; extra == "docs"
Requires-Dist: flit>=3.7.1 ; extra == "tests"
Requires-Dist: pytest>=7.1.2 ; extra == "tests"
Requires-Dist: pytest-cov>=3.0.0 ; extra == "tests"
Requires-Dist: python-decouple>=3.6 ; extra == "tests"
Requires-Dist: pytest-asyncio>=0.23.6 ; extra == "tests"
Project-URL: Documentation, https://async-firebase-rest-api.readthedocs.io/
Project-URL: Source, https://github.com/matiaskotlik/async-firebase-rest-api
Provides-Extra: docs
Provides-Extra: tests

<div align="center">

   <h1> Async Firebase REST API </h1>

   <p>A simple python wrapper for <a href="https://firebase.google.com">Google's Firebase REST API's</a>.</p>
   <p>This package is an async fork of <a href="https://github.com/AsifArmanRahman/firebase-rest-api">AsifArmanRahman/firebase-rest-api</a>.</p>
   <br>

</div>

<div align="center">
   <a href="https://pepy.tech/project/async-firebase-rest-api"> 
      <img alt="Total Downloads" src="https://static.pepy.tech/personalized-badge/async-firebase-rest-api?period=total&units=international_system&left_color=blue&right_color=grey&left_text=Downloads">
   </a>
</div>

<div align="center">

   <a href="https://github.com/matiaskotlik/async-firebase-rest-api/actions/workflows/tests.yml">
      <img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/matiaskotlik/async-firebase-rest-api/tests.yml?label=tests&logo=Pytest">
   </a>

   <a href="https://async-firebase-rest-api.readthedocs.io/en/latest/">

      <img alt="Read the Docs" src="https://img.shields.io/readthedocs/async-firebase-rest-api?logo=Read%20the%20Docs&logoColor=white">

   </a>
   <a href="https://codecov.io/gh/matiaskotlik/async-firebase-rest-api"> 
      <img alt="CodeCov" src="https://codecov.io/gh/matiaskotlik/async-firebase-rest-api/branch/main/graph/badge.svg?token=N7TE1WVZ7W"> 
   </a>

</div>

<div align="center">
   <a href="https://pypi.org/project/async-firebase-rest-api/"> 
      <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/async-firebase-rest-api?logo=python">
   </a>
   <a href="https://pypi.org/project/async-firebase-rest-api/"> 
      <img alt="PyPI" src="https://img.shields.io/pypi/v/async-firebase-rest-api?logo=PyPI&logoColor=white">
   </a>
</div>



## Installation

```shell
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](https://console.firebase.google.com) Console.

2. Register an Web App.


### Example Usage

```python
# 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'))
```

