Metadata-Version: 2.4
Name: firebase-messaging
Version: 0.4.4
Summary: FCM/GCM push notification client
Project-URL: Homepage, https://github.com/sdb9696/firebase-messaging
Project-URL: Repository, https://github.com/sdb9696/firebase-messaging
Project-URL: Documentation, http://firebase-messaging.readthedocs.io/
Project-URL: Bug Tracker, https://github.com/sdb9696/firebase-messaging/issues
Author-email: sdb9696 <sdb9696@users.noreply.github.com>
License: MIT
License-File: LICENSE
Keywords: Firebase,Firebase Cloud Messaging,Google Cloud Messaging
Classifier: Environment :: Other Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9.0
Requires-Dist: aiohttp>=3.9.3
Requires-Dist: cryptography>=2.5
Requires-Dist: http-ece~=1.1.0
Requires-Dist: protobuf<6,>=4.24.3
Provides-Extra: docs
Requires-Dist: myst-parser; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints~=1.24; extra == 'docs'
Requires-Dist: sphinx-rtd-theme~=1.3; extra == 'docs'
Requires-Dist: sphinx==7.1.2; extra == 'docs'
Description-Content-Type: text/x-rst

==================
Firebase Messaging
==================

A library to subscribe to GCM/FCM and receive notifications within a python application.

When should I use `firebase-messaging` ?
----------------------------------------

- I want to **receive** push notifications sent using Firebase Cloud Messaging in a python application.

When should I not use `firebase-messaging` ?
--------------------------------------------

- I want to **send** push notifications (use the firebase SDK instead)
- My application is running on a FCM supported platform (Android, iOS, Web).

Install
-------

PyPi::

    $ pip install firebase-messaging


Requirements
------------

- Firebase configuration to receive notifications

Usage
-----

Must be run inside an asyncio event loop.

python::

    from firebase_messaging import FcmPushClient, FcmRegisterConfig

    def on_notification(obj, notification, data_message):
        # Do something with the notification
        pass

    credentials = None  # Start off with none or load from previous save
    def on_credentials_updated(creds):
        # save the credentials to a file here for future use

    fcm_config = FcmRegisterConfig(fcm-project-id, fcm-app-id, fcm-api-key, fcm-message-sender-id)
    pc = FcmPushClient(on_notification, fcm_config, credentials, on_credentials_updated)
    fcm_token = await pc.checkin_or_register()

    await pc.start()

    # Adapt the following for your usage
    while some_condition_to_keep_listening:
        asyncio.sleep(2)


Attribution
-----------

Code originally based on typescript/node implementation by
`Matthieu Lemoine <https://github.com/MatthieuLemoine/push-receiver>`_.
See `this blog post <https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0>`_ for more details.

Converted to python by
`lolisamurai <https://github.com/Francesco149/push_receiver>`_

http decryption logic in decrypt.py by
`Martin Thomson <https://github.com/web-push-libs/encrypted-content-encoding>`_
