Skip to content

Commit 4619f4f

Browse files
authored
Merge pull request #17 from drachenminister/patch-1
Implement canceling emergency-priority retries
2 parents edaf510 + 646e22d commit 4619f4f

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
@@ -164,6 +164,17 @@ def poll(self):
164164
setattr(self, when, request.answer[when])
165165
return request
166166

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

168179
class GlanceRequest(Request):
169180
"""Class representing a glance request to the Pushover API. This is

0 commit comments

Comments
 (0)