Pusher extension for the Flask microframework.
Built on top of https://pypi.python.org/pypi/pusher/
pip install flask-pusher
In your flask configuration file/object:
PUSHERAPP_ID = '<your app id>'
PUSHERAPP_KEY = '<your pusher key>'
PUSHERAPP_SECRET = '<your pusher secret>'
from flask import Flask
from flask_pusher import Pusher
app = Flask(__name__)
pusher = Pusher(app)
or in extensions.py
from flask_pusher import Pusher
pusher = Pusher()
from flask import Flask
from extensions import pusher
def create_app():
app = Flask(__name__)
pusher.init_app(app)
return app
from extensions import pusher
pusher[channel_name].trigger('event', {
'message': msg,
})
Documentation for communicating with the Pusher service with the python client are on the Pusher website: