Files
dss/core/realtime/notification.py
2013-07-17 16:02:38 +01:00

18 lines
530 B
Python

import requests
from core.serialisers import json
from dss import localsettings
# TODO(fergal.moran@gmail.com): refactor these out to classes to avoid duplicating constants below
HEADERS = {
'content-type': 'application/json'
}
def post_notification(notification_url):
payload = {'message': notification_url}
data = json.dumps(payload)
r = requests.post(localsettings.REALTIME_HOST + '/api/notification', data=data, headers=HEADERS)
if r.status_code == 200:
return ""
else:
return r.text