{
"info": {
"author": "Jonas Hagstedt",
"author_email": "hagstedt@gmail.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4"
],
"description": "# SwampDragon notifications\n\n[ ](https://codeship.com/projects/63149)\n\nNotify your users in real time.\n\n**Note** Since notifications isn't always an essential part of a system, only signed in users receive notifications. \n\n\n# Prerequisites\n\n* Redis 2.8+\n\n\n# Installation\n\n pip install swampdragon-notifications\n\nAdd the following to `INSTALLED_APPS`:\n \n INSTALLED_APPS = [\n ...\n 'swampdragon',\n 'swampdragon_auth',\n 'swampdragon_notifications',\n ]\n\n\nSet the SwampDragon connection to:\n\n SWAMP_DRAGON_CONNECTION = ('swampdragon_notifications.notification_connection.Connection', '/data')\n \n\n# Setup\n\n\n {% load swampdragon_tags static %}\n ...\n \n {% swampdragon_settings %}\n \n \n \n \n\n\n# JavaScript API\n\n## Get number of users online:\n\n \n notifications.onlineCount(function (count) {\n console.log(count);\n });\n\n\n## User count onChange event:\n\nTriggered when a new user comes online or someone goes offline\n\n \n notifications.onlineCountChange(function (count) {\n setUserCount(count);\n });\n\n\n## Desktop notifications\n\nTo enable desktop notifications: `notifications.enableDesktopNotifications();`.\n\nTo disable desktop notifications: `notifications.disableDesktopNotifications();`.\n\nTo trigger a desktop notifications:\n\n\n var payload = {\n body:notification.some_value,\n icon: notification.icon // assuming an icon url is available,\n tag: 'foo'\n }\n notifications.desktopNotification('New foo', payload);\n\n\n\n# Example setup (settings.py)\n\nThe following example setup will send both email notifications and realtime notifications.\nTo disable the email notifications: remove `'swampdragon_notifications.backends.email_notifications.EmailNotification'` from `SWAMP_DRAGON_NOTIFICATION_BACKENDS`.\n\n \n SWAMP_DRAGON_NOTIFICATION_BACKENDS = [\n ('realtime', 'swampdragon_notifications.backends.realtime_notifications.RealtimeNotification'),\n ('email', 'swampdragon_notifications.backends.email_notifications.EmailNotification'),\n ]\n \n \n SWAMP_DRAGON_NOTIFICATIONS = {\n 'foo': {\n 'processor': 'app.subject_renderer.foo_to_dict',\n 'icon': 'http://placekitten.com/g/64/64',\n 'subject': 'A new foo',\n 'template': 'new_foo_notification',\n }\n }\n \n SWAMP_DRAGON_HEARTBEAT_ENABLED = True\n SWAMP_DRAGON_HEARTBEAT_FREQUENCY = 1000 * 60 * 5 # Five minutes\n\n\nCreate a file called subject_renderer.py in your project, and add a new function:\n\n \n def foo_to_dict(notification, **kwargs):\n return {\n ...\n }\n\nThe function `foo_to_dict` should return a dictionary with any data you want to pass on to the client.\n\n\n## Subject processors\n\nA subject processor belongs to a notification type (defined in `SWAMP_DRAGON_NOTIFICATIONS`).\n\nThe processor is a function, and takes a `notification` and `**kwargs` as arguments, and returns a dictionary.\n\nExample processor:\n\n \n def foo_processor(notification, **kwargs):\n return {\n 'foo_id': notification.subject.pk,\n 'timestamp': now(),\n 'extra_value': kwargs.get('extra_value')\n }\n\n\n## Settings\n\nEnable heart beat if you are using realtime notifications.\nThis helps keep track on who is online.\n\n\n SWAMP_DRAGON_HEARTBEAT_ENABLED = True\n SWAMP_DRAGON_HEARTBEAT_FREQUENCY = 1000 * 60 * 5 # Five minutes\n\n\n### `SWAMP_DRAGON_NOTIFICATIONS`\n\nTo customise notification, add `SWAMP_DRAGON_NOTIFICATIONS` to settings.\nThis is a dictionary:\n\n\n SWAMP_DRAGON_NOTIFICATIONS = {\n 'foo': {\n 'processor': 'app.subject_renderer.foo_to_dict'\n 'template': 'standard_email', # Only used by email backend,\n 'subject': 'Dear {}, you have a new notification', # Only used by email backend \n 'title': 'Notification', \n 'icon': 'http://placekitten.com/g/64/64'\n }\n }\n\n`template` and `subject` only concern the default email backend.\n\n\n### Notification backends\n\nThere are two notification backends: email and realtime.\n\nSet notification backends:\n\n\n SWAMP_DRAGON_NOTIFICATION_BACKENDS = [\n ('realtime', 'swampdragon_notifications.backends.realtime_notifications.RealtimeNotification'),\n ('email', 'swampdragon_notifications.backends.email_notifications.EmailNotification'),\n ]\n\n`'swampdragon_notifications.backends.realtime_notifications.RealtimeNotification'` is enabled by default.\n\n\n\n### Email notification backend\n\nThe emails will, by default, be sent from `settings.SERVER_EMAIL`.\nTo change the sender email address specify `NOTIFICATION_SENDER` in settings.\n\n\n#### Creating a custom notification backend\n\nAdd a new file to your project `foo_notification_backend.py`.\n\nAdd a class `FooNotificationBackend`\n\nimplement the function `def notify(notification):` in your custom notification backend\n\n\n from swampdragon_notifications.backends.base_backend import BaseBackend\n\n class FooNotificationBackend(BaseBackend):\n def notify(self, notification):\n pass\n \n \n3. Add the new backend to your settings\n\n\n SWAMP_DRAGON_NOTIFICATION_BACKENDS = [\n ...\n ('foo', 'myproj.foo_notification_backend.FooNotificationBackend'),\n ]",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/jonashagstedt/swampdragon-notifications",
"keywords": "Notifications,realtime notifications",
"license": "BSD",
"maintainer": null,
"maintainer_email": null,
"name": "swampdragon-notifications",
"package_url": "https://pypi.org/project/swampdragon-notifications/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/swampdragon-notifications/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/jonashagstedt/swampdragon-notifications"
},
"release_url": "https://pypi.org/project/swampdragon-notifications/0.1.3.2/",
"requires_dist": null,
"requires_python": null,
"summary": "SwampDragon notifications",
"version": "0.1.3.2"
},
"last_serial": 1775831,
"releases": {
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "1f286225370704455ef7cf4b24f3a5f1",
"sha256": "1f758c6b85a2c2b744cd1122b91ca340c38e503345455cb1e4ab1212126cfb01"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "1f286225370704455ef7cf4b24f3a5f1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14962,
"upload_time": "2015-02-15T17:13:30",
"url": "https://files.pythonhosted.org/packages/90/ce/b2925e56d3f1a169f54aaa0d07243046ba3fa70cb3cffabb0065056dfc82/swampdragon-notifications-0.1.0.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "cb66c1aa5d2050c16f1cc0cfe0dcee19",
"sha256": "790d9726859581c29b7c9276aa5335d500f62059da7759d4bfeaf09668fc61a3"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.0.zip",
"has_sig": false,
"md5_digest": "cb66c1aa5d2050c16f1cc0cfe0dcee19",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27026,
"upload_time": "2015-02-15T17:13:32",
"url": "https://files.pythonhosted.org/packages/12/5b/fbca773225eabeb0b244bdd56286ce72831edbd8f53053d93060a07ebb6d/swampdragon-notifications-0.1.0.zip"
}
],
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "26550bd4130eeb2a068a9f759ad14902",
"sha256": "de5aeb4447804b4717893f83f32838a2650eb1aad274d364e97386d40cceecea"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "26550bd4130eeb2a068a9f759ad14902",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15924,
"upload_time": "2015-02-22T21:41:37",
"url": "https://files.pythonhosted.org/packages/72/21/ebccd6412511e5b6cf7d419fd5a5513c973694f6429e5c6404747e1b1ab1/swampdragon-notifications-0.1.1.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "b423b52ccfdfe57f7e98ba76ea83a155",
"sha256": "14b2305dc5b50f26f168dd49c779daff44bf0d34b4998c9be306ff69e0e0274e"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.1.zip",
"has_sig": false,
"md5_digest": "b423b52ccfdfe57f7e98ba76ea83a155",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28861,
"upload_time": "2015-02-22T21:42:41",
"url": "https://files.pythonhosted.org/packages/8a/51/9432272cb183f8f6b0f6835cfeb9213be8a1004b7dc88c52b117d0e7dec3/swampdragon-notifications-0.1.1.zip"
}
],
"0.1.1.1": [
{
"comment_text": "",
"digests": {
"md5": "f65a00dd6e15c22d01725b904a9720af",
"sha256": "b5d397b6094abfbbfcbe445f512835c950fe3f061a08063b730732285ef0fae9"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f65a00dd6e15c22d01725b904a9720af",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15956,
"upload_time": "2015-02-22T21:43:08",
"url": "https://files.pythonhosted.org/packages/51/3a/cc8cd5005fb985174406a4b4bbda04e65c055d046eb7a1d248484f2d53a5/swampdragon-notifications-0.1.1.1.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "bfc0524de15aac98c307a0d13f155e05",
"sha256": "a259ea58559dbcbbc1725abf1e1258090c8c22a1f7671abfd8b29cf542fe77fe"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.1.1.zip",
"has_sig": false,
"md5_digest": "bfc0524de15aac98c307a0d13f155e05",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 29028,
"upload_time": "2015-02-22T21:43:10",
"url": "https://files.pythonhosted.org/packages/f5/5e/909b8cf3f43bc158fe95dfc857eecfb5fa12be897cda1c3a22b6a50981c6/swampdragon-notifications-0.1.1.1.zip"
}
],
"0.1.2": [
{
"comment_text": "",
"digests": {
"md5": "2ed67185d8cbd188a140e1e3b61adf0a",
"sha256": "7ebc84344e85067e4ecfbe2210aa91dff3e6b20969f11ef3fd11d7b21f9aad9a"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "2ed67185d8cbd188a140e1e3b61adf0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15955,
"upload_time": "2015-02-26T21:43:31",
"url": "https://files.pythonhosted.org/packages/7c/b5/3f083ccbaa8146a957f276ecfda4d2c4e5432c43cb17bffcc1ae7dcd97e5/swampdragon-notifications-0.1.2.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "3d50e7803c1194bd48f1eee665b70024",
"sha256": "211ad8b3ca7afd2b720b0ec6dfabdce120a0c10a232a5c0c5bf66ab38673ca49"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.2.zip",
"has_sig": false,
"md5_digest": "3d50e7803c1194bd48f1eee665b70024",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28908,
"upload_time": "2015-02-26T21:43:34",
"url": "https://files.pythonhosted.org/packages/ae/3f/0d48623861053a76853647ef638238222ecbf12cad0b2ee2d71b46899f7a/swampdragon-notifications-0.1.2.zip"
}
],
"0.1.3": [],
"0.1.3.1": [
{
"comment_text": "",
"digests": {
"md5": "12bcfd9ec600a3bb5f3740991e29b2a4",
"sha256": "a8b5d07f0b89edd592f1b235e79207e5e94a28fd3ff6d831951ec99787c978c2"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.3.1.tar.gz",
"has_sig": false,
"md5_digest": "12bcfd9ec600a3bb5f3740991e29b2a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14418,
"upload_time": "2015-03-02T11:10:02",
"url": "https://files.pythonhosted.org/packages/75/54/9525b9861c29dc4f7d802f9d52eaabc3da610ff18998a24a9aebbb4f47a0/swampdragon-notifications-0.1.3.1.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "3e743713ccc584b30898f70a21a803b4",
"sha256": "7ff1537e94077ff3c51d9aa46ad0a19195281c2fa43167f4ecef1de941a776d8"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.3.1.zip",
"has_sig": false,
"md5_digest": "3e743713ccc584b30898f70a21a803b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28563,
"upload_time": "2015-03-02T11:10:04",
"url": "https://files.pythonhosted.org/packages/e5/41/6bf4d876091f986a49fcd82a09333f309ecd461787a8776821f9b27a53b6/swampdragon-notifications-0.1.3.1.zip"
}
],
"0.1.3.2": [
{
"comment_text": "",
"digests": {
"md5": "25bb47380253637e7e87e225ff8d7d57",
"sha256": "9cfe208b1950be53837356e3db4ebefce676f2f771fb4aa1618715d5b84718be"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.3.2.tar.gz",
"has_sig": false,
"md5_digest": "25bb47380253637e7e87e225ff8d7d57",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14474,
"upload_time": "2015-10-19T10:12:01",
"url": "https://files.pythonhosted.org/packages/e1/bd/11f0616312ac11a0428fc17f9424c423ec08a0d54fc2f59eec9b498d4e24/swampdragon-notifications-0.1.3.2.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "71d5ba0aa2b8f6ea7f4e0c8c62b894db",
"sha256": "7b71910bd863a60f0bdf3b8f15b9f334fa08379a25c0555879933a7aa42fb0aa"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.3.2.zip",
"has_sig": false,
"md5_digest": "71d5ba0aa2b8f6ea7f4e0c8c62b894db",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28601,
"upload_time": "2015-10-19T10:12:17",
"url": "https://files.pythonhosted.org/packages/49/20/5fb98c04093fc537ca6a4464bc59c5a586c893dbf083962e5964812ac50c/swampdragon-notifications-0.1.3.2.zip"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "25bb47380253637e7e87e225ff8d7d57",
"sha256": "9cfe208b1950be53837356e3db4ebefce676f2f771fb4aa1618715d5b84718be"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.3.2.tar.gz",
"has_sig": false,
"md5_digest": "25bb47380253637e7e87e225ff8d7d57",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14474,
"upload_time": "2015-10-19T10:12:01",
"url": "https://files.pythonhosted.org/packages/e1/bd/11f0616312ac11a0428fc17f9424c423ec08a0d54fc2f59eec9b498d4e24/swampdragon-notifications-0.1.3.2.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "71d5ba0aa2b8f6ea7f4e0c8c62b894db",
"sha256": "7b71910bd863a60f0bdf3b8f15b9f334fa08379a25c0555879933a7aa42fb0aa"
},
"downloads": -1,
"filename": "swampdragon-notifications-0.1.3.2.zip",
"has_sig": false,
"md5_digest": "71d5ba0aa2b8f6ea7f4e0c8c62b894db",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28601,
"upload_time": "2015-10-19T10:12:17",
"url": "https://files.pythonhosted.org/packages/49/20/5fb98c04093fc537ca6a4464bc59c5a586c893dbf083962e5964812ac50c/swampdragon-notifications-0.1.3.2.zip"
}
]
}