Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Extras
* Telegram support requires installing as ``ntfy[telegram]``
* Instapush support requires installing as ``ntfy[instapush]``
* Slack support requires installing as ``ntfy[slack]``
* Simplepush support requires installing as ``ntfy[simplepush]``

To install multiple extras, separate with commas: e.g., ``ntfy[pid,emjoi]``.

Expand Down Expand Up @@ -157,11 +158,14 @@ Optional parameters:

`Simplepush <https://simplepush.io>`_ - ``simplepush``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Requires extras, install like this: pip install ntfy[simplepush].

Required parameter:
* ``key`` - Your Simplepush key, created by installing the Android App (no registration required) at https://simplepush.io

Optional parameters:
* ``event`` - sets ringtone and vibration pattern for incoming notifications (can be defined in the simplepush app)
* ``password`` - password for end-to-end encryption (has to be also defined in the app)
* ``event`` - identifier for ringtone and vibration pattern for incoming notifications (can be defined in the simplepush app)

XMPP - ``xmpp``
~~~~~~~~~~~~~~~
Expand Down
13 changes: 5 additions & 8 deletions ntfy/backends/simplepush.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests
from simplepush import generate_payload

from ..config import USER_AGENT

Expand All @@ -7,24 +8,20 @@ def notify(title,
message,
key,
event=None,
password=None,
retcode=None):
"""
Required paramter:
* ``key`` - The Simplepush identification key, created by
installing the Android App (https://simplepush.io)

Optional parameters:
* ``password`` - password for end-to-end encryption (can
be set in the app)
* ``event`` - use custom ringtones and vibration patterns
"""

data = {
'title': title if len(title) <= 20 else title[:19] + u'\u2026',
'msg': message,
'key': key
}

if event:
data['event'] = event
data = generate_payload(key, title if len(title) <= 200 else title[:199] + u'\u2026', message, event, password)

headers = {'User-Agent': USER_AGENT}

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'emoji': ['emoji'],
'pid':['psutil'],
'slack':['slacker'],
'simplepush':['simplepush'],
}
test_deps = ['mock', 'sleekxmpp', 'emoji', 'psutil']

Expand Down