Skip to content

Flask extension for PyFCM - Python client for FCM

Notifications You must be signed in to change notification settings

idtlabs-xyz/flask-pyfcm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask-PyFCM

Build Status

version number: 0.0.1

contributor: Piotr Poteralski

Overview

Flask extension for PyFCM - Python client for FCM

Installation

To install use pip:

$ pip install Flask-PyFCM

Or clone the repo:

$ git clone https://github.com/rstit/flask-airbrake.git
$ python setup.py install

Usage

You’ll need to do, is setup config:

# Your api-key can be gotten from:  https://console.firebase.google.com/project/<project-name>/settings/cloudmessaging
FCM_API_KEY = os_env.get('FCM_API_KEY')
# Not required proxy dict
FCM_PROXY_DICT = {
    "http"  : "http://127.0.0.1",
    "https" : "http://127.0.0.1",
}

Then initialize PyFCM under your application:

from flask_pyfcm import FCM
fcm = FCM()

def create_app():
    app = Flask(__name__)
    fcm.init_app(app)
    return app

You can implement handler for getting bad ids to your devices implementation: For example: SQLAlchemy:

@fcm.failure_handler
def handle_bad_ids(ids, *args):
    for device in Device.query.filter(Device.id.in_(ids)):
        device.mark_as_inactive()

Contributing

TBD

TODO

  • Coverage
  • Docs

About

Flask extension for PyFCM - Python client for FCM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%