diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2018-01-22 21:33:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-22 21:33:02 -0500 |
| commit | 3915fd1088d03f6e7d078105bfc831170e0ee81c (patch) | |
| tree | 552b214c9b282ae3600d02a08e5037a554bf989e | |
| parent | 669cb270283b5e6e3fb5bc637f33d5306d37c38f (diff) | |
| parent | ace42c4163316f8b8ca38f7f267e29377f66c117 (diff) | |
| download | python-pushover-3915fd1088d03f6e7d078105bfc831170e0ee81c.tar.gz | |
Merge pull request #22 from copart/master
added command line arguments for retry and expire. Both are required…
| -rw-r--r-- | AUTHORS.rst | 1 | ||||
| -rw-r--r-- | CHANGES.rst | 6 | ||||
| -rw-r--r-- | pushover.py | 16 |
3 files changed, 18 insertions, 5 deletions
diff --git a/AUTHORS.rst b/AUTHORS.rst index d01144f..3ff30d3 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -8,3 +8,4 @@ Contributors * Thibaut Horel <thibaut.horel@gmail.com> * Filip Lundborg <filip@filipl.se> * Philip Lundrigan <philipbl@cs.utah.edu> +* Steve Miller <copart@gmail.com> diff --git a/CHANGES.rst b/CHANGES.rst index 7c84e22..dffe593 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changes ------- +0.4 (tbd) +~~~~~~~~~~~~~~~~ + +* Add support for expire and retry provided at command line. These are + required by priority 2 messages. + 0.3 (2016-12-29) ~~~~~~~~~~~~~~~~ diff --git a/pushover.py b/pushover.py index c51664d..c5c3793 100644 --- a/pushover.py +++ b/pushover.py @@ -1,6 +1,6 @@ -# pushover 0.2 +# pushover 0.3 # -# Copyright (C) 2013-2014 Thibaut Horel <thibaut.horel@gmail.com> +# Copyright (C) 2013-2016 Thibaut Horel <thibaut.horel@gmail.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -330,7 +330,9 @@ For more details and bug reports, see: https://github.com/Thibauth/python-pushov parser.add_argument("--user-key", "-u", help="Pushover user key") parser.add_argument("message", help="message to send") parser.add_argument("--title", "-t", help="message title") - parser.add_argument("--priority", "-p", help="message priority (-1, 0, 1 or 2)") + parser.add_argument("--priority", "-p", help="message priority (-1, 0, 1 or 2)", type=int) + parser.add_argument("--retry", "-r", help="how often (in seconds) the Pushover servers will send the same notification to the user", type=int) + parser.add_argument("--expire", "-e", help="how many seconds your notification will continue to be retried for (every retry seconds).", type=int) parser.add_argument("--url", help="additional url") parser.add_argument("--url-title", help="additional url title") parser.add_argument("-c", "--config", help="configuration file\ @@ -341,17 +343,21 @@ For more details and bug reports, see: https://github.com/Thibauth/python-pushov parser.add_argument("--version", "-v", action="version", help="output version information and exit", version=""" -%(prog)s 0.2 +%(prog)s 0.3 Copyright (C) 2013-2016 Thibaut Horel <thibaut.horel@gmail.com> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.""") args = parser.parse_args() + if args.priority and args.priority==2 and (args.retry is None or args.expire is None): + parser.error("priority of 2 requires expire and retry") + Client(args.user_key, None, args.api_token, args.config, args.profile).send_message(args.message, title=args.title, priority=args.priority, url=args.url, - url_title=args.url_title, timestamp=True) + url_title=args.url_title, timestamp=True, + retry=args.retry,expire=args.expire) if __name__ == "__main__": main() |
