diff options
| author | Sam Birch <sam.m.birch@gmail.com> | 2014-07-22 23:47:12 -0400 |
|---|---|---|
| committer | Sam Birch <sam.m.birch@gmail.com> | 2014-07-22 23:47:12 -0400 |
| commit | 989327291c6a53e457f034c2c1d03848eb32ed46 (patch) | |
| tree | a523d6cbb1d660c64cbd55ff72aa19d6f6928d7f | |
| parent | 23d81cc523315aa7159a9dd10f843ba412004614 (diff) | |
| download | python-pushover-989327291c6a53e457f034c2c1d03848eb32ed46.tar.gz | |
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.
| -rw-r--r-- | pushover.py | 6 |
1 files changed, 6 insertions, 0 deletions
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.") |
