Add apptoken for Pushover
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user