diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-07-28 14:24:04 +0200 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-07-28 14:24:04 +0200 |
| commit | 2705e945ac0f113fda2deabe7af7265537e04b5c (patch) | |
| tree | 385c0ee5ce42a190fd76648f441f4a566da6a5fe /pushover.py | |
| parent | 7172eeb31c51fcfcc7e1f0a157758b7d741ca78d (diff) | |
| download | python-pushover-2705e945ac0f113fda2deabe7af7265537e04b5c.tar.gz | |
Fix #3 add console script entry point
Diffstat (limited to 'pushover.py')
| -rw-r--r-- | pushover.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pushover.py b/pushover.py index 6e84a3b..68765dc 100644 --- a/pushover.py +++ b/pushover.py @@ -10,11 +10,13 @@ A typical use of the module looks like this:: client.send_message("Hello!", title="Hello", priority=1) """ -import requests import time from ConfigParser import RawConfigParser +from argparse import ArgumentParser import os +import requests + __all__ = ["init", "get_sounds", "Client", "MessageRequest", "InitError", "RequestError", "get_client"] @@ -247,9 +249,7 @@ def get_client(profile=None, config_path='~/.pushover'): device=config.get(section, 'device') ) - -if __name__ == "__main__": - from argparse import ArgumentParser +def main(): parser = ArgumentParser(description="Send a message to pushover.") parser.add_argument("--token", help="Pushover application token", required=True) @@ -266,3 +266,6 @@ if __name__ == "__main__": Client(args.client).send_message(args.message, title=args.title, priority=args.priority, url=args.url, url_title=args.url_title, timestamp=True) + +if __name__ == "__main__": + main() |
