aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2016-12-28 12:06:37 -0500
committerGitHub <noreply@github.com>2016-12-28 12:06:37 -0500
commit4619f4f4ed3ebf5f41aca19063ee979db7099a9a (patch)
treee483db51cfbbcad0c6cd1beee0707476ce94befe
parentedaf5102fd5ffefaa8fc8036f927decc4a809961 (diff)
parent646e22d37303c248038e1850f879dd96a7b02eb3 (diff)
downloadpython-pushover-4619f4f4ed3ebf5f41aca19063ee979db7099a9a.tar.gz
Merge pull request #17 from drachenminister/patch-1
Implement canceling emergency-priority retries
-rw-r--r--pushover.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pushover.py b/pushover.py
index 4f5dcf9..b89f92a 100644
--- a/pushover.py
+++ b/pushover.py
@@ -164,6 +164,17 @@ class MessageRequest(Request):
setattr(self, when, request.answer[when])
return request
+ def cancel(self):
+ """If the message request has a priority of 2, Pushover will keep
+ sending the same notification until it either reaches its ``expire`` value
+ or is aknowledged by the client. Calling the :func:`cancel` function will
+ cancel the notification early.
+ """
+ if (self.receipt and not any(getattr(self, parameter)
+ for parameter in self.parameters)):
+ request = Request("post", RECEIPT_URL + self.receipt + "/cancel.json", {})
+ return request
+
class GlanceRequest(Request):
"""Class representing a glance request to the Pushover API. This is