Browse Source

Notifo notification

pull/51/merge
Ruud 14 years ago
parent
commit
ce8701f3cc
  1. 3
      couchpotato/core/notifications/notifo/__init__.py
  2. 6
      couchpotato/core/notifications/notifo/main.py

3
couchpotato/core/notifications/notifo/__init__.py

@ -20,8 +20,7 @@ config = [{
'name': 'username', 'name': 'username',
}, },
{ {
'name': 'password', 'name': 'api_key',
'type': 'password',
}, },
], ],
} }

6
couchpotato/core/notifications/notifo/main.py

@ -12,14 +12,12 @@ class Notifo(Notification):
url = 'https://api.notifo.com/v1/send_notification' url = 'https://api.notifo.com/v1/send_notification'
def conf(self, attr):
return Env.setting(attr, 'notifo')
def notify(self, message = '', data = {}): def notify(self, message = '', data = {}):
if self.isDisabled(): return if self.isDisabled(): return
try: try:
params = { params = {
'label': self.default_title,
'msg': toUnicode(message), 'msg': toUnicode(message),
} }
@ -28,7 +26,7 @@ class Notifo(Notification):
} }
handle = self.urlopen(self.url, params = params, headers = headers) handle = self.urlopen(self.url, params = params, headers = headers)
result = json.load(handle) result = json.loads(handle)
if result['status'] != 'success' or result['response_message'] != 'OK': if result['status'] != 'success' or result['response_message'] != 'OK':
raise Exception raise Exception

Loading…
Cancel
Save