aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Lundrigan <philiplundrigan@gmail.com>2016-02-12 00:32:56 -0700
committerPhilip Lundrigan <philiplundrigan@gmail.com>2016-02-12 00:32:56 -0700
commit10d59b7625943f325ca130c99e06d7dff7256db2 (patch)
tree5cdb04794ab6e0532d5dd9ae3c70d2c3a44bf256
parent9c9c03a40ce7e362a9075aad5a3fe9a71933b8a9 (diff)
downloadpython-pushover-10d59b7625943f325ca130c99e06d7dff7256db2.tar.gz
Add ability to specify device through client
Previously, this could only be done through the config.
-rw-r--r--pushover.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pushover.py b/pushover.py
index b670266..a84abdc 100644
--- a/pushover.py
+++ b/pushover.py
@@ -181,7 +181,7 @@ class Client:
def __init__(self, user_key=None, device=None, api_token=None,
config_path="~/.pushoverrc", profile="Default"):
- params = _get_config(profile, config_path, user_key, api_token)
+ params = _get_config(profile, config_path, user_key, api_token, device)
self.user_key = params["user_key"]
if not self.user_key:
raise UserError
@@ -244,7 +244,7 @@ class Client:
def _get_config(profile='Default', config_path='~/.pushoverrc',
- user_key=None, api_token=None):
+ user_key=None, api_token=None, device=None):
config_path = os.path.expanduser(config_path)
config = RawConfigParser()
config.read(config_path)
@@ -257,6 +257,8 @@ def _get_config(profile='Default', config_path='~/.pushoverrc',
params["user_key"] = user_key
if api_token:
params["api_token"] = api_token
+ if device:
+ params["device"] = device
if not TOKEN:
init(params["api_token"])