mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-23 00:25:18 +00:00
api: Use nchan headers for pushing events
This commit is contained in:
parent
b830ce7671
commit
114e67ed6a
@ -18,7 +18,7 @@ def publish(event_type, event_data):
|
|||||||
notification = urllib.request.Request(
|
notification = urllib.request.Request(
|
||||||
url,
|
url,
|
||||||
event_data.encode("utf-8"),
|
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")
|
notification.add_header("User-Agent", "Certidude API")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -28,10 +28,10 @@ def publish(event_type, event_data):
|
|||||||
if err.code == 404:
|
if err.code == 404:
|
||||||
print("No subscribers on the channel")
|
print("No subscribers on the channel")
|
||||||
else:
|
else:
|
||||||
raise
|
print("Failed to submit event, %s" % err)
|
||||||
else:
|
else:
|
||||||
print("Push server returned:", response.code, body)
|
print("Push server returned:", response.code, body)
|
||||||
response.close()
|
response.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user