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',
'name': 'pushover',
'label': 'Pushover',
'options': [
{
'name': 'enabled',
@@ -20,10 +19,6 @@ config = [{
'name': 'user_key',
'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',
'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.notifications.base import Notification
from httplib import HTTPSConnection
from urllib import urlencode
log = CPLog(__name__)
class Pushover(Notification):
app_token = 'YkxHMYDZp285L265L3IwH3LmzkTaCy'
def notify(self, message = '', data = {}):
if self.isDisabled(): return
@@ -16,7 +17,7 @@ class Pushover(Notification):
data = {
'user': self.conf('user_key'),
'token': self.conf('app_token'),
'token': self.app_token,
'message': toUnicode(message),
'priority': self.conf('priority')
}
@@ -24,7 +25,7 @@ class Pushover(Notification):
http_handler.request('POST',
"/1/messages.json",
headers = {'Content-type': 'application/x-www-form-urlencoded'},
body = urlencode(data)
body = tryUrlencode(data)
)
response = http_handler.getresponse()