aiofcm - An efficient Firebase Cloud Messaging Client Library for Python/asyncio
aiofcm is a library designed specifically for sending messages such as push-notifications to Android devices via Firebase Cloud Messaging platform. aiofcm provides an efficient client through asynchronous XMPP protocol for use with Python’s asyncio framework.
aiofcm requires Python 3.5 or later.
Performance
In my testing aiofcm allows you to send on average 1k messages per second on a single core.
Features
Internal connection pool which adapts to the current load
Sending notification and/or data messages
Ability to set TTL (time to live) for messages
Ability to set priority for messages
Ability to set collapse-key for messages
Installation
Use pip to install:
$ pip install aiofcm
Basic Usage
from uuid import uuid4
from aiofcm import FCM, Message, PRIORITY_HIGH
async def run():
fcm = FCM(123456789000, '<API_KEY>')
message = Message(
device_token='<DEVICE_TOKEN>',
notification={ # optional
"title": "Hello from Firebase",
"body": "This is notification",
"sound": "default"
},
data={"score": "3x1"}, # optional
message_id=str(uuid4()), # optional
time_to_live=3, # optional
priority=PRIORITY_HIGH, # optional
)
await fcm.send_message(message)
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
License
aiofcm is developed and distributed under the Apache 2.0 license.
Release files for aiofcm 1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiofcm-1.4.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiofcm-1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.6 kB
Release files / aiofcm-1.4.tar.gz
| Download URL | aiofcm-1.4.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff0e97c4f3d4db65a459ef44c485a80869f0567992a15b757942cb37b4b050d0
|
|
BLAKE2b-256 checksum How to use checksums |
654c515e44a26c5e9c7496ea682ad6ca5400b3db6a23c922cd682b224c33b855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / aiofcm-1.4-py3-none-any.whl
| Download URL | aiofcm-1.4-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41ed993a74f19fc9f82df16ca66a9f32d0f3a3d1d851d44d95c67b3078ab6700
|
|
BLAKE2b-256 checksum How to use checksums |
262f9bd60b441c9ec08a5e43f285089e06851bbfaf789d7dc4626b43375002d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|