Skip to content

Commit ace42c4

Browse files
committedDec 29, 2017
added command line arguments for retry and expire. Both are required on priority 2 messages.
1 parent 669cb27 commit ace42c4

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed
 

‎AUTHORS.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Contributors
88
* Thibaut Horel <thibaut.horel@gmail.com>
99
* Filip Lundborg <filip@filipl.se>
1010
* Philip Lundrigan <philipbl@cs.utah.edu>
11+
* Steve Miller <copart@gmail.com>

‎CHANGES.rst

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changes
22
-------
33

4+
0.4 (tbd)
5+
~~~~~~~~~~~~~~~~
6+
7+
* Add support for expire and retry provided at command line. These are
8+
required by priority 2 messages.
9+
410
0.3 (2016-12-29)
511
~~~~~~~~~~~~~~~~
612

‎pushover.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# pushover 0.2
1+
# pushover 0.3
22
#
3-
# Copyright (C) 2013-2014 Thibaut Horel <thibaut.horel@gmail.com>
3+
# Copyright (C) 2013-2016 Thibaut Horel <thibaut.horel@gmail.com>
44

55
# This program is free software: you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by
@@ -330,7 +330,9 @@ def main():
330330
parser.add_argument("--user-key", "-u", help="Pushover user key")
331331
parser.add_argument("message", help="message to send")
332332
parser.add_argument("--title", "-t", help="message title")
333-
parser.add_argument("--priority", "-p", help="message priority (-1, 0, 1 or 2)")
333+
parser.add_argument("--priority", "-p", help="message priority (-1, 0, 1 or 2)", type=int)
334+
parser.add_argument("--retry", "-r", help="how often (in seconds) the Pushover servers will send the same notification to the user", type=int)
335+
parser.add_argument("--expire", "-e", help="how many seconds your notification will continue to be retried for (every retry seconds).", type=int)
334336
parser.add_argument("--url", help="additional url")
335337
parser.add_argument("--url-title", help="additional url title")
336338
parser.add_argument("-c", "--config", help="configuration file\
@@ -341,17 +343,21 @@ def main():
341343
parser.add_argument("--version", "-v", action="version",
342344
help="output version information and exit",
343345
version="""
344-
%(prog)s 0.2
346+
%(prog)s 0.3
345347
Copyright (C) 2013-2016 Thibaut Horel <thibaut.horel@gmail.com>
346348
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
347349
This is free software: you are free to change and redistribute it.
348350
There is NO WARRANTY, to the extent permitted by law.""")
349351

350352
args = parser.parse_args()
353+
if args.priority and args.priority==2 and (args.retry is None or args.expire is None):
354+
parser.error("priority of 2 requires expire and retry")
355+
351356
Client(args.user_key, None, args.api_token, args.config,
352357
args.profile).send_message(args.message, title=args.title,
353358
priority=args.priority, url=args.url,
354-
url_title=args.url_title, timestamp=True)
359+
url_title=args.url_title, timestamp=True,
360+
retry=args.retry,expire=args.expire)
355361

356362
if __name__ == "__main__":
357363
main()

0 commit comments

Comments
 (0)
Please sign in to comment.