Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added command line arguments for retry and expire. Both are required… #22

Merged
merged 1 commit into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -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)
~~~~~~~~~~~~~~~~

Expand Down
16 changes: 11 additions & 5 deletions pushover.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -330,7 +330,9 @@ def main():
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\
Expand All @@ -341,17 +343,21 @@ def main():
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()