firebase-messaging


Namefirebase-messaging JSON
Version 0.4.4 PyPI version JSON
download
home_pageNone
SummaryFCM/GCM push notification client
upload_time2024-09-27 15:46:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9.0
licenseMIT
keywords firebase firebase cloud messaging google cloud messaging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==================
Firebase Messaging
==================

.. image:: https://badge.fury.io/py/firebase-messaging.svg
    :alt: PyPI Version
    :target: https://badge.fury.io/py/firebase-messaging

.. image:: https://github.com/sdb9696/firebase-messaging/actions/workflows/ci.yml/badge.svg?branch=main
    :alt: Build Status
    :target: https://github.com/sdb9696/firebase-messaging/actions/workflows/ci.yml?branch=main

.. image:: https://coveralls.io/repos/github/sdb9696/firebase-messaging/badge.svg?branch=main
    :alt: Coverage
    :target: https://coveralls.io/github/sdb9696/firebase-messaging?branch=main

.. image:: https://readthedocs.org/projects/firebase-messaging/badge/?version=latest
    :alt: Documentation Status
    :target: https://firebase-messaging.readthedocs.io/?badge=latest

.. image:: https://img.shields.io/pypi/pyversions/firebase-messaging.svg
    :alt: Py Versions
    :target: https://pypi.python.org/pypi/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>`_

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "firebase-messaging",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9.0",
    "maintainer_email": null,
    "keywords": "Firebase, Firebase Cloud Messaging, Google Cloud Messaging",
    "author": null,
    "author_email": "sdb9696 <sdb9696@users.noreply.github.com>",
    "download_url": "https://files.pythonhosted.org/packages/20/9e/038c82e44bebfac9f865e9ca249a6c1bea382fd7fd6c409543fb89133b3b/firebase_messaging-0.4.4.tar.gz",
    "platform": null,
    "description": "==================\nFirebase Messaging\n==================\n\n.. image:: https://badge.fury.io/py/firebase-messaging.svg\n    :alt: PyPI Version\n    :target: https://badge.fury.io/py/firebase-messaging\n\n.. image:: https://github.com/sdb9696/firebase-messaging/actions/workflows/ci.yml/badge.svg?branch=main\n    :alt: Build Status\n    :target: https://github.com/sdb9696/firebase-messaging/actions/workflows/ci.yml?branch=main\n\n.. image:: https://coveralls.io/repos/github/sdb9696/firebase-messaging/badge.svg?branch=main\n    :alt: Coverage\n    :target: https://coveralls.io/github/sdb9696/firebase-messaging?branch=main\n\n.. image:: https://readthedocs.org/projects/firebase-messaging/badge/?version=latest\n    :alt: Documentation Status\n    :target: https://firebase-messaging.readthedocs.io/?badge=latest\n\n.. image:: https://img.shields.io/pypi/pyversions/firebase-messaging.svg\n    :alt: Py Versions\n    :target: https://pypi.python.org/pypi/firebase-messaging#\n\nA library to subscribe to GCM/FCM and receive notifications within a python application.\n\nWhen should I use `firebase-messaging` ?\n----------------------------------------\n\n- I want to **receive** push notifications sent using Firebase Cloud Messaging in a python application.\n\nWhen should I not use `firebase-messaging` ?\n--------------------------------------------\n\n- I want to **send** push notifications (use the firebase SDK instead)\n- My application is running on a FCM supported platform (Android, iOS, Web).\n\nInstall\n-------\n\nPyPi::\n\n    $ pip install firebase-messaging\n\n\nRequirements\n------------\n\n- Firebase configuration to receive notifications\n\nUsage\n-----\n\nMust be run inside an asyncio event loop.\n\npython::\n\n    from firebase_messaging import FcmPushClient, FcmRegisterConfig\n\n    def on_notification(obj, notification, data_message):\n        # Do something with the notification\n        pass\n\n    credentials = None  # Start off with none or load from previous save\n    def on_credentials_updated(creds):\n        # save the credentials to a file here for future use\n\n    fcm_config = FcmRegisterConfig(fcm-project-id, fcm-app-id, fcm-api-key, fcm-message-sender-id)\n    pc = FcmPushClient(on_notification, fcm_config, credentials, on_credentials_updated)\n    fcm_token = await pc.checkin_or_register()\n\n    await pc.start()\n\n    # Adapt the following for your usage\n    while some_condition_to_keep_listening:\n        asyncio.sleep(2)\n\n\nAttribution\n-----------\n\nCode originally based on typescript/node implementation by\n`Matthieu Lemoine <https://github.com/MatthieuLemoine/push-receiver>`_.\nSee `this blog post <https://medium.com/@MatthieuLemoine/my-journey-to-bring-web-push-support-to-node-and-electron-ce70eea1c0b0>`_ for more details.\n\nConverted to python by\n`lolisamurai <https://github.com/Francesco149/push_receiver>`_\n\nhttp decryption logic in decrypt.py by\n`Martin Thomson <https://github.com/web-push-libs/encrypted-content-encoding>`_\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "FCM/GCM push notification client",
    "version": "0.4.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/sdb9696/firebase-messaging/issues",
        "Documentation": "http://firebase-messaging.readthedocs.io/",
        "Homepage": "https://github.com/sdb9696/firebase-messaging",
        "Repository": "https://github.com/sdb9696/firebase-messaging"
    },
    "split_keywords": [
        "firebase",
        " firebase cloud messaging",
        " google cloud messaging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bc1c48b37bf53b908a6fe7c98282729762d0505077ce28306543c0e879c1a00",
                "md5": "14ffda50964616a44311fabe5ad1a128",
                "sha256": "43aa4bd9014674006ec0462464b2caa85f70f7a8c19c407ba618b15bc8d6ff0f"
            },
            "downloads": -1,
            "filename": "firebase_messaging-0.4.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "14ffda50964616a44311fabe5ad1a128",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9.0",
            "size": 40017,
            "upload_time": "2024-09-27T15:46:24",
            "upload_time_iso_8601": "2024-09-27T15:46:24.738527Z",
            "url": "https://files.pythonhosted.org/packages/0b/c1/c48b37bf53b908a6fe7c98282729762d0505077ce28306543c0e879c1a00/firebase_messaging-0.4.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "209e038c82e44bebfac9f865e9ca249a6c1bea382fd7fd6c409543fb89133b3b",
                "md5": "ec158019d19d25a42747b08e93c06550",
                "sha256": "b9593e2340442a08a4c3641dacbc54a1e688431027d2fd63a7e92efe3ec11ae8"
            },
            "downloads": -1,
            "filename": "firebase_messaging-0.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ec158019d19d25a42747b08e93c06550",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9.0",
            "size": 39375,
            "upload_time": "2024-09-27T15:46:26",
            "upload_time_iso_8601": "2024-09-27T15:46:26.263253Z",
            "url": "https://files.pythonhosted.org/packages/20/9e/038c82e44bebfac9f865e9ca249a6c1bea382fd7fd6c409543fb89133b3b/firebase_messaging-0.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-27 15:46:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sdb9696",
    "github_project": "firebase-messaging",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "firebase-messaging"
}
        
Elapsed time: 4.33875s