Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing a minor change to where the from_http and to_binary methods/functions come from. #28

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions parliament/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import logging

from flask import Flask, request
from cloudevents.http import CloudEvent, from_http, to_binary
from cloudevents.http import CloudEvent
from cloudevents.conversion import from_http, to_binary
from .invocation import Context


Expand All @@ -29,10 +30,11 @@ def create(func):
def handle_post():
context = Context(request)
try:
context.cloud_event = from_http(request.headers,
context.cloud_event = from_http(CloudEvent, request.headers,
request.get_data())
except Exception:
except Exception as e:
app.logger.warning('No CloudEvent available')
app.logger.exception(e)
app.logger.exception(traceback.print_exc())
return invoke(func, context)

Expand Down
3 changes: 2 additions & 1 deletion tests/event/event_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from cloudevents.http import CloudEvent, to_binary
from cloudevents.http import CloudEvent
from cloudevents.conversion import to_binary


def test_post_cloud_event(client):
Expand Down
Loading