Skip to content

Commit 646e22d

Browse files
Implement canceling emergency-priority retries
see API description at https://pushover.net/api
1 parent 38fdcc7 commit 646e22d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pushover.py

+11
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,17 @@ def poll(self):
163163
setattr(self, when, request.answer[when])
164164
return request
165165

166+
def cancel(self):
167+
"""If the message request has a priority of 2, Pushover will keep
168+
sending the same notification until it either reaches its ``expire`` value
169+
or is aknowledged by the client. Calling the :func:`cancel` function will
170+
cancel the notification early.
171+
"""
172+
if (self.receipt and not any(getattr(self, parameter)
173+
for parameter in self.parameters)):
174+
request = Request("post", RECEIPT_URL + self.receipt + "/cancel.json", {})
175+
return request
176+
166177

167178
class Client:
168179
"""This is the main class of the module. It represents a specific Pushover

0 commit comments

Comments
 (0)