1 parent
aa0f7bfb36
commit
d2fd098030
3 files changed
+201
No files matched your search
@@ -0,0 +1,24 @@
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.notifications.base import Notification
|
||||
from pynmwp import PyNMWP
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
|
||||
class NotifyMyWP(Notification):
|
||||
|
||||
def notify(self, message = '', data = {}):
|
||||
|
||||
if self.isDisabled():
|
||||
return
|
||||
|
||||
keys = self.conf('api_key').split(',')
|
||||
p = PyNMWP(keys, self.conf('dev_key'))
|
||||
|
||||
response = p.push(application = self.default_title, event = message, description = message, priority = self.conf('priority'), batch_mode = len(keys) > 1)
|
||||
|
||||
for key in keys:
|
||||
if not response[key]['Code'] == u'200':
|
||||
log.error('Could not send notification to NotifyMyWindowsPhone (%s). %s' % (key, response[key]['message']))
|
||||
|
||||
return response
|
||||
Reference in new issue
Block a user