Private GIT

Skip to content
Snippets Groups Projects
Commit 657ffd7c authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Fix some out of order paramters in calls to private pushover notifier methods

Fix most pylint errors in pushover notifier
parent ee246dde
No related branches found
No related tags found
No related merge requests found
......@@ -29,10 +29,10 @@ from sickrage.helper.exceptions import ex
API_URL = "https://api.pushover.net/1/messages.json"
# pylint: disable=W0232,C1001
class PushoverNotifier:
def test_notify(self, userKey=None, apiKey=None):
return self._notifyPushover("This is a test notification from SickRage", 'Test', userKey, apiKey, force=True)
return self._notifyPushover("This is a test notification from SickRage", 'Test', userKey=userKey, apiKey=apiKey, force=True)
def _sendPushover(self, msg, title, sound=None, userKey=None, apiKey=None):
"""
......@@ -40,9 +40,9 @@ class PushoverNotifier:
msg: The message to send (unicode)
title: The title of the message
userKey: The pushover user id to send the message to (or to subscribe with)
sound: The notification sound to use
userKey: The pushover user id to send the message to (or to subscribe with)
apiKey: The pushover api key to use
returns: True if the message succeeded, False otherwise
"""
......@@ -63,8 +63,7 @@ class PushoverNotifier:
# send the request to pushover
try:
if sickbeard.PUSHOVER_SOUND != "default":
args = {
"token": apiKey,
args = {"token": apiKey,
"user": userKey,
"title": title.encode('utf-8'),
"message": msg.encode('utf-8'),
......@@ -75,8 +74,7 @@ class PushoverNotifier:
}
else:
# sound is default, so don't send it
args = {
"token": apiKey,
args = {"token": apiKey,
"user": userKey,
"title": title.encode('utf-8'),
"message": msg.encode('utf-8'),
......@@ -109,7 +107,7 @@ class PushoverNotifier:
elif e.code == 401:
#HTTP status 401 if the user doesn't have the service added
subscribeNote = self._sendPushover(msg, title, userKey, apiKey)
subscribeNote = self._sendPushover(msg, title, sound=sound, userKey=userKey, apiKey=apiKey)
if subscribeNote:
logger.log("Subscription sent", logger.DEBUG)
return True
......@@ -151,12 +149,13 @@ class PushoverNotifier:
def _notifyPushover(self, title, message, sound=None, userKey=None, apiKey=None, force=False):
"""
Sends a pushover notification based on the provided info or SB config
Sends a pushover notification based on the provided info or SR config
title: The title of the notification to send
message: The message string to send
userKey: The userKey to send the notification to
sound: The notification sound to use
userKey: The userKey to send the notification to
apiKey: The apiKey to use to send the notification
force: Enforce sending, for instance for testing
"""
......@@ -166,7 +165,7 @@ class PushoverNotifier:
logger.log("Sending notification for " + message, logger.DEBUG)
return self._sendPushover(message, title, userKey, apiKey)
return self._sendPushover(message, title, sound=sound, userKey=userKey, apiKey=apiKey)
notifier = PushoverNotifier
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment