Add apptoken for Pushover

This commit is contained in:
Ruud
2012-04-22 19:56:35 +02:00
parent aae2b53b2d
commit 98176ea259
2 changed files with 5 additions and 9 deletions
@@ -9,7 +9,6 @@ config = [{
{ {
'tab': 'notifications', 'tab': 'notifications',
'name': 'pushover', 'name': 'pushover',
'label': 'Pushover',
'options': [ 'options': [
{ {
'name': 'enabled', 'name': 'enabled',
@@ -20,10 +19,6 @@ config = [{
'name': 'user_key', 'name': 'user_key',
'description': 'Register on pushover.net to get one.' 'description': 'Register on pushover.net to get one.'
}, },
{
'name': 'app_token',
'description': 'You can get one <a href="https://pushover.net/apps/build">here</a>.'
},
{ {
'name': 'priority', 'name': 'priority',
'default': 0, 'default': 0,
@@ -1,14 +1,15 @@
from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification from couchpotato.core.notifications.base import Notification
from httplib import HTTPSConnection from httplib import HTTPSConnection
from urllib import urlencode
log = CPLog(__name__) log = CPLog(__name__)
class Pushover(Notification): class Pushover(Notification):
app_token = 'YkxHMYDZp285L265L3IwH3LmzkTaCy'
def notify(self, message = '', data = {}): def notify(self, message = '', data = {}):
if self.isDisabled(): return if self.isDisabled(): return
@@ -16,7 +17,7 @@ class Pushover(Notification):
data = { data = {
'user': self.conf('user_key'), 'user': self.conf('user_key'),
'token': self.conf('app_token'), 'token': self.app_token,
'message': toUnicode(message), 'message': toUnicode(message),
'priority': self.conf('priority') 'priority': self.conf('priority')
} }
@@ -24,7 +25,7 @@ class Pushover(Notification):
http_handler.request('POST', http_handler.request('POST',
"/1/messages.json", "/1/messages.json",
headers = {'Content-type': 'application/x-www-form-urlencoded'}, headers = {'Content-type': 'application/x-www-form-urlencoded'},
body = urlencode(data) body = tryUrlencode(data)
) )
response = http_handler.getresponse() response = http_handler.getresponse()