Skip to content

sdb9696/firebase-messaging

Repository files navigation

Firebase Messaging

PyPI Version

Build Status

Coverage

Documentation Status

Py Versions

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 sender id to receive notification
  • Firebase serverKey to send notification (optional)

Usage

python:

from firebase_messaging import FcmPushClient

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

pc = FcmPushClient(None)
fcm_token = pc.checkin(sender_id, app_id)

# Notify the service you're connecting to of your FCM token

pc.start(YOUR_NOTIFICATION_CALLBACK)

Attribution

Code originally based on typescript/node implementation by Matthieu Lemoine. See this blog post for more details.

Converted to python by lolisamurai

http decryption logic in decrypt.py by Martin Thomson

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages