1
0
mirror of https://github.com/laurivosandi/certidude synced 2024-12-22 16:25:17 +00:00

api: Use nchan headers for pushing events

This commit is contained in:
Lauri Võsandi 2016-02-17 16:15:06 +02:00
parent b830ce7671
commit 114e67ed6a

View File

@ -18,7 +18,7 @@ def publish(event_type, event_data):
notification = urllib.request.Request(
url,
event_data.encode("utf-8"),
{"Event-ID": b"TODO", "Event-Type":event_type.encode("ascii")})
{"X-EventSource-Event":event_type.encode("ascii")})
notification.add_header("User-Agent", "Certidude API")
try:
@ -28,10 +28,10 @@ def publish(event_type, event_data):
if err.code == 404:
print("No subscribers on the channel")
else:
raise
print("Failed to submit event, %s" % err)
else:
print("Push server returned:", response.code, body)
response.close()
response.close()