{ "info": { "author": "Iuri de Silvio", "author_email": "iurisilvio@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Flask-Pusher\n============\n[![Build Status](https://travis-ci.org/iurisilvio/Flask-Pusher.svg?branch=master)](https://travis-ci.org/iurisilvio/Flask-Pusher)\n[![Coverage Status](https://coveralls.io/repos/iurisilvio/Flask-Pusher/badge.png?branch=master)](https://coveralls.io/r/iurisilvio/Flask-Pusher?branch=master)\n\n\nFlask extension for Pusher. It is a thin wrapper around the official client,\nbinding Flask app to Pusher client.\n\nInstallation\n------------\n\nInstall `Flask-Pusher` module from PyPI.\n\n```\npip install Flask-Pusher\n```\n\nConfiguration\n-------------\n\nThe basic configuration for Pusher is `app_id`, `key` and `secret`. These values are available in Pusher web interface.\n\n```python\nPUSHER_APP_ID = 'your-pusher-app-id'\nPUSHER_KEY = 'your-pusher-key'\nPUSHER_SECRET = 'your-pusher-secret'\n```\n\nYou can connect to a custom host/port, with these configurations:\n\n```python\nPUSHER_HOST = 'api.pusherapp.com'\nPUSHER_PORT = '80'\n```\n\nThe extension auto configure the Pusher encoder to use the `app.json_encoder`.\n\nUsage\n-----\n\nThis extension simplify Pusher configuration and bind the client to your app.\n\n```python\nfrom flask import Flask\nfrom flask_pusher import Pusher\n\napp = Flask(__name__)\npusher = Pusher(app)\n# Use pusher = Pusher(app, url_prefix=\"/yourpath\") to mount the plugin in another path\n```\n\nThe extension gives you two ways to access the pusher client:\n\n```python\n# you can just get the client from current_app\nclient = current_app.extensions[\"pusher\"]\n\n# or you can get it from the extension\nclient = pusher.client\n```\n\nIn both cases, it is a reference to the pusher client.\n\n```\nclient.trigger('channel_name', 'event', {\n 'message': msg,\n})\n```\n\nCheck the docs for the Pusher python client here: http://pusher.com/docs/server_api_guide#/lang=python\n\nPusher authentication\n---------------------\n\nPusher has authenticated private and presence channels. `Flask-Pusher` create\nthe `/pusher/auth` route to handle it. To support these authenticated routes,\njust decorate a function with `@pusher.auth`.\n\nThis function must return `True` for authorized and `False` for unauthorized\nusers. It happens in the request context, so you have all `Flask` features,\nincluding for example the `Flask-Login` current user.\n\nSet the `PUSHER_AUTH` configuration to change the auth endpoint. The default value is `/auth`.\n\n```python\nfrom flask_login import current_user\n\n@pusher.auth\ndef pusher_auth(channel_name, socket_id):\n if 'foo' in channel_name:\n # refuse foo channels\n return False\n # authorize only authenticated users\n return current_user.is_authenticated()\n```\n\nIt also transparently supports batch auth, based on `pusher-js-auth`: https://github.com/dirkbonhomme/pusher-js-auth`. The authentication function is called for each channel in the batch.\n\nRead more about user authentication here: http://pusher.com/docs/authenticating_users\n\n\nPusher channel data\n-------------------\n\nPresence channels require `channel_data`. `Flask-Pusher` send by default the\n`user_id` with the `socket_id`, because it is a required field.\n\nThe `@pusher.channel_data` gives you a way to set other values. If a `user_id`\nkey is returned, it overrides the default `user_id`.\n\n```python\nfrom flask_login import current_user\n\n@pusher.channel_data\ndef pusher_channel_data(channel_name, socket_id):\n return {\n \"name\": current_user.name\n }\n```\n\nPusher webhooks\n---------------\n\nPusher has webhooks to send websocket events to your server.\n\nFlask-Pusher create the routes to handle these webhooks and validate the headers `X-Pusher-Key` and `X-Pusher-Signature`.\n\n```python\nfrom flask import request\n\n@pusher.webhooks.channel_existence\ndef channel_existence_webhook():\n print request.json\n\n@pusher.webhooks.presence\ndef presence_webhook():\n print request.json\n\n@pusher.webhooks.client\ndef client_webhook():\n print request.json\n```\n\nThe JSON request is documented in Pusher docs: http://pusher.com/docs/webhooks\n\nThese webhooks routes are mounted in `/pusher/events/channel_existence`, `/pusher/events/presence` and `/pusher/events/client`. Configure your Pusher app to send webhooks to these routes.\n\n\nDisclaimer\n----------\nThis project is not affiliated with Pusher or Flask.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.github.com/iurisilvio/Flask-Pusher", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Flask-Pusher", "package_url": "https://pypi.org/project/Flask-Pusher/", "platform": "any", "project_url": "https://pypi.org/project/Flask-Pusher/", "project_urls": { "Homepage": "https://www.github.com/iurisilvio/Flask-Pusher" }, "release_url": "https://pypi.org/project/Flask-Pusher/2.0.2/", "requires_dist": [ "Flask", "pusher (<3)", "Flask-Jsonpify" ], "requires_python": "", "summary": "Flask extension for Pusher", "version": "2.0.2" }, "last_serial": 4325873, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "a46dd590c5dd2b3b1c11927ea517fc19", "sha256": "8e71c07c9d031e62ddf03db387af64ea43f4f6f30a10ddc3de25ff482de31e34" }, "downloads": -1, "filename": "Flask-Pusher-0.1.tar.gz", "has_sig": false, "md5_digest": "a46dd590c5dd2b3b1c11927ea517fc19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1375, "upload_time": "2014-11-26T16:52:07", "url": "https://files.pythonhosted.org/packages/80/14/7abc3bc184e3b693247762e25253395692eab7bf3f520a6efd2bfe9fc9b4/Flask-Pusher-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "6e5092583d83d269f282eddc8d4a67f3", "sha256": "2df94c209a3ad952cdcd93d011c6c780c32099a8767f0fb94168840b84fd2281" }, "downloads": -1, "filename": "Flask-Pusher-0.2.tar.gz", "has_sig": false, "md5_digest": "6e5092583d83d269f282eddc8d4a67f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1903, "upload_time": "2014-12-02T13:09:08", "url": "https://files.pythonhosted.org/packages/e9/65/b4215d3e1fecf1de2e1d8502398db92d47b79900b23e4a51b92b15c56c72/Flask-Pusher-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "9808b7ec2b50270210b7ad8a8000ece6", "sha256": "7a3871cc8a6334d0977a3fa3b6af873884cdaf0132c88bfaecfe34003ddc8c50" }, "downloads": -1, "filename": "Flask-Pusher-0.3.tar.gz", "has_sig": false, "md5_digest": "9808b7ec2b50270210b7ad8a8000ece6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2422, "upload_time": "2014-12-11T12:18:39", "url": "https://files.pythonhosted.org/packages/a6/9e/dfbcdd69502e99d678011b5c088e7070740a8ab6e379afb5224ef013eeb8/Flask-Pusher-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "f57814b0533f808ab00fbcc2917a13d0", "sha256": "b7fc7684ed678ef32c2a16ebb637ed508ad22f7d9da2b372dfdca0644237ad4c" }, "downloads": -1, "filename": "Flask-Pusher-0.4.tar.gz", "has_sig": false, "md5_digest": "f57814b0533f808ab00fbcc2917a13d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2656, "upload_time": "2015-04-04T22:22:58", "url": "https://files.pythonhosted.org/packages/20/34/ee5da9418aff44dc88b89b8707e516065b9de657a2dfd5debe95a4783276/Flask-Pusher-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "9fc46075c5fea3a3ce0ccf1c7a9f6d6b", "sha256": "a598a8551d9f9422b698027acaa4939cf1055ce131f74da81325cf6cf51d2e06" }, "downloads": -1, "filename": "Flask-Pusher-0.4.1.tar.gz", "has_sig": false, "md5_digest": "9fc46075c5fea3a3ce0ccf1c7a9f6d6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2670, "upload_time": "2015-04-25T17:31:55", "url": "https://files.pythonhosted.org/packages/ba/89/16a597c52d91814642a1612a856aa64302e6aecb5e9e78305e98c78ddeda/Flask-Pusher-0.4.1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "80b3d20bc5e3222a6d1ff49c2b8ab87e", "sha256": "c796a0a4ad7c8aa8c4050cc150c00ba69aef8ad1e31fcfaa15130dd25fe9e2d8" }, "downloads": -1, "filename": "Flask-Pusher-1.0.tar.gz", "has_sig": false, "md5_digest": "80b3d20bc5e3222a6d1ff49c2b8ab87e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2810, "upload_time": "2015-04-25T19:52:22", "url": "https://files.pythonhosted.org/packages/d5/50/4164df61a49d5a82a5619c2f1bf00a7d05918c04762cb81376ab6957e0f1/Flask-Pusher-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "c39543363491d8d144416817fb645c90", "sha256": "0d5979a8ed93f9dd08be54b4497b326b1b47700532975d7271321ab291781136" }, "downloads": -1, "filename": "Flask-Pusher-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c39543363491d8d144416817fb645c90", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2929, "upload_time": "2015-04-26T01:45:02", "url": "https://files.pythonhosted.org/packages/1e/2c/8926c3569d39207128046f9bd227e9a4bbc518d9208cc61006f10716f3f8/Flask-Pusher-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "0b39f703035765cda67ed75cc8a74bd3", "sha256": "ac1c42c963eab5e5ab4da7010aab98e60dc1d702ba2b541847af05784d7c4b77" }, "downloads": -1, "filename": "Flask-Pusher-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0b39f703035765cda67ed75cc8a74bd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3026, "upload_time": "2015-05-09T20:57:49", "url": "https://files.pythonhosted.org/packages/23/82/07fa7a7cbc196cea7e632c25a308166644c07f98223fd715cdc68f306f1f/Flask-Pusher-1.0.2.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "cb603c14cde388cb2300aa269c831df8", "sha256": "6253809d9256f2901434d6bd4152949f1133d4a9c7a9284c62df2a6c175cec1e" }, "downloads": -1, "filename": "Flask-Pusher-1.1.tar.gz", "has_sig": false, "md5_digest": "cb603c14cde388cb2300aa269c831df8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3047, "upload_time": "2016-05-19T17:22:13", "url": "https://files.pythonhosted.org/packages/3e/7f/26157aaf40ad54e7804b81d0a9865b5c533a1072a467cac3449809361300/Flask-Pusher-1.1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "7885fd7e02d9c649151bbb95dcf68318", "sha256": "9af4a64c93154c1df598af300c165a5e4d6ec233d7d0c75a347b84eb53bcdfc4" }, "downloads": -1, "filename": "Flask-Pusher-1.1.1.tar.gz", "has_sig": false, "md5_digest": "7885fd7e02d9c649151bbb95dcf68318", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3056, "upload_time": "2016-06-20T17:26:42", "url": "https://files.pythonhosted.org/packages/fd/1a/2702347e036136fb9fb4fdac331577e9c1d6e084e7a780eba995b6f005ff/Flask-Pusher-1.1.1.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "1f76b876e9063994164ae3614b05a93f", "sha256": "202b1e287ad801b7f87ecf24f02bd0a266a93f1dd9a5e91794d181364dc74ae4" }, "downloads": -1, "filename": "Flask-Pusher-1.2.1.tar.gz", "has_sig": false, "md5_digest": "1f76b876e9063994164ae3614b05a93f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3279, "upload_time": "2016-12-19T00:00:42", "url": "https://files.pythonhosted.org/packages/e8/86/2d9fd129d034a8a26ddad474861f445476131609075c7f1c2313edaf2fb7/Flask-Pusher-1.2.1.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "60d02743e9d1f273f828149409bbfc0a", "sha256": "21336c087436f91b25a67b9396c8dac12987a2dfc7aac29bc2ea3e038b2a4a46" }, "downloads": -1, "filename": "Flask_Pusher-2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "60d02743e9d1f273f828149409bbfc0a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3840, "upload_time": "2018-09-30T19:15:42", "url": "https://files.pythonhosted.org/packages/29/53/e40666877aac81fba24e04352f2b65b9523c6d4791beca7085c0e7ca4af5/Flask_Pusher-2.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1614e99b7a5ba4008c7231f0be333efc", "sha256": "769f861c2d76789500659a144c8091f0dc0ea82cfa44b01ccb8707df20f65d01" }, "downloads": -1, "filename": "Flask_Pusher-2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1614e99b7a5ba4008c7231f0be333efc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3844, "upload_time": "2018-09-30T19:20:25", "url": "https://files.pythonhosted.org/packages/36/65/9b1b033c5aec42dad57f6dafd97821735bad407919b0a4d4571a5c34a806/Flask_Pusher-2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "297468a15704083b1d54468857a70dc1", "sha256": "af2c5966eb3fe7ef58312b3088cad2dc7c093ddef6691bdb6cab9caf1829b3e8" }, "downloads": -1, "filename": "Flask-Pusher-2.0.tar.gz", "has_sig": false, "md5_digest": "297468a15704083b1d54468857a70dc1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5078, "upload_time": "2018-09-30T19:14:53", "url": "https://files.pythonhosted.org/packages/59/fc/4a333f93ea15127fe77d16d19329e71146c863bbdb074c7ba56cb3463d65/Flask-Pusher-2.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "82019f2dd7bdcca36288c813f52e13f5", "sha256": "12efb70b8af4bfc200f73e248e0679b8ff76cfff437661a603268bb1de13f972" }, "downloads": -1, "filename": "Flask_Pusher-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "82019f2dd7bdcca36288c813f52e13f5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5473, "upload_time": "2018-09-30T19:29:34", "url": "https://files.pythonhosted.org/packages/b5/fa/08b039e7eca1086c4a07644497a52e94601caaf2030f3883d10721089bb3/Flask_Pusher-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aed5e0a714ce7dc52de792d7a1cd32ad", "sha256": "2d4e1ace0443fd2e67055e21e4f29734371aa80dfddb5a36effd74a26922cf28" }, "downloads": -1, "filename": "Flask-Pusher-2.0.1.tar.gz", "has_sig": false, "md5_digest": "aed5e0a714ce7dc52de792d7a1cd32ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5676, "upload_time": "2018-09-30T19:29:35", "url": "https://files.pythonhosted.org/packages/db/e6/ef29a49852c57643c5192db4b1e39ef413f4e1bf47bf27a71c68e70e4151/Flask-Pusher-2.0.1.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "600a8cef9a5c3394efd58b81dde2bf2a", "sha256": "82955209cb746bc1a64081881e3e80b375f0bb87c3efccb15dc251319d5e8ff4" }, "downloads": -1, "filename": "Flask_Pusher-2.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "600a8cef9a5c3394efd58b81dde2bf2a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5474, "upload_time": "2018-09-30T20:41:43", "url": "https://files.pythonhosted.org/packages/55/30/206951b41a278bef4ab763ae9ebf2ef8c03c866ac5e683a379fd405566c1/Flask_Pusher-2.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e8014c9a29f90e30690876a51ebaa1cb", "sha256": "0489795edac86a2ed8629056ea9a04b7b921abfdd984af63048f672aa476b606" }, "downloads": -1, "filename": "Flask-Pusher-2.0.2.tar.gz", "has_sig": false, "md5_digest": "e8014c9a29f90e30690876a51ebaa1cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6727, "upload_time": "2018-09-30T20:41:44", "url": "https://files.pythonhosted.org/packages/d8/2a/06d4f616af00607982cb49133b37d6f46d94126a4791f084045f2b4bb279/Flask-Pusher-2.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "600a8cef9a5c3394efd58b81dde2bf2a", "sha256": "82955209cb746bc1a64081881e3e80b375f0bb87c3efccb15dc251319d5e8ff4" }, "downloads": -1, "filename": "Flask_Pusher-2.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "600a8cef9a5c3394efd58b81dde2bf2a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5474, "upload_time": "2018-09-30T20:41:43", "url": "https://files.pythonhosted.org/packages/55/30/206951b41a278bef4ab763ae9ebf2ef8c03c866ac5e683a379fd405566c1/Flask_Pusher-2.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e8014c9a29f90e30690876a51ebaa1cb", "sha256": "0489795edac86a2ed8629056ea9a04b7b921abfdd984af63048f672aa476b606" }, "downloads": -1, "filename": "Flask-Pusher-2.0.2.tar.gz", "has_sig": false, "md5_digest": "e8014c9a29f90e30690876a51ebaa1cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6727, "upload_time": "2018-09-30T20:41:44", "url": "https://files.pythonhosted.org/packages/d8/2a/06d4f616af00607982cb49133b37d6f46d94126a4791f084045f2b4bb279/Flask-Pusher-2.0.2.tar.gz" } ] }