From 989327291c6a53e457f034c2c1d03848eb32ed46 Mon Sep 17 00:00:00 2001 From: Sam Birch Date: Tue, 22 Jul 2014 23:47:12 -0400 Subject: init() in get_client() I think it makes sense to init() in here too, and allow the user to keep the api_tokens in the config file. --- pushover.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pushover.py') diff --git a/pushover.py b/pushover.py index 73ed59d..2284c7a 100644 --- a/pushover.py +++ b/pushover.py @@ -213,10 +213,12 @@ def get_client(profile=None, config_path='~/.pushover'): ``` #This is the default profile (returned by get_client() with no arguments.) [Default] + api_token=aaaaaa user_key=xxxxxx # You can specify a device as well. [Sam-iPhone] + api_token=bbbbbb user_key=yyyyyy device=iPhone ``` @@ -236,11 +238,15 @@ def get_client(profile=None, config_path='~/.pushover'): config.read(config_path) section = profile if profile is not None else 'Default' + + init(config.get(section, 'api_token'), sound=False) + return Client( config.get(section, 'user_key'), device=config.get(section, 'device') if config.has_option(section, 'device') else None ) + if __name__ == "__main__": from argparse import ArgumentParser parser = ArgumentParser(description="Send a message to pushover.") -- cgit v1.2.3-70-g09d2