Async Firebase Client - a Python asyncio client to interact with Firebase Cloud Messaging.
Project description
async-firebase is a lightweight asynchronous client to interact with Firebase Cloud Messaging for sending push notification to Android and iOS devices
- Free software: MIT license
- Requires: Python 3.6+
Features
- Extremely lightweight and does not rely on
firebase-admin
which is hefty - Send push notifications to Android and iOS devices
- Set TTL (time to live) for notifications
- Set priority for notifications
- Set collapse-key for notifications
- Dry-run mode for testing purpose
Installation
$ pip install async-firebase
Getting started
To send push notification to either Android or iOS device:
import asyncio
from async_firebase import AsyncFirebaseClient
async def main():
client = AsyncFirebaseClient()
client.creds_from_service_account_file("secret-store/mobile-app-79225efac4bb.json")
# or using dictionary object
# client.creds_from_service_account_info({...}})
device_token = "..."
response = await client.push(
device_token=device_token,
notification_title="Store Changes",
notification_body="Recent store changes",
notification_data={
"discount": "15%",
"key_1": "value_1"
},
priority="normal",
apns_topic="store-updates",
collapse_key="push",
alert_text="test-alert",
category="test-category",
badge=1,
)
print(response)
if __name__ == "__main__":
asyncio.run(main())
This prints:
{"name": "projects/mobile-app/messages/0:2367799010922733%7606eb557606ebff"}
License
async-firebase
is offered under the MIT license.
Source code
The latest developer version is available in a GitHub repository: https://github.com/healthjoy/async-firebase
Project details
Release history Release notifications | RSS feed
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-0.4.0.tar.gz
(8.8 kB
view hashes)
Built Distribution
Close
Hashes for async_firebase-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b89251f46eab7a9c2f691ff25246490a50fd60081bc6574b2b0434cead1d3a90 |
|
MD5 | 30622353ec074f92e56aebf8d91f0482 |
|
BLAKE2b-256 | f9a617721dcf64545f5a39261c8aca8bc10cf4495d23b03dbbbb8069b351b759 |