diff --git a/cloudevents/conversion.py b/cloudevents/conversion.py index 41db4e6..24d3da7 100644 --- a/cloudevents/conversion.py +++ b/cloudevents/conversion.py @@ -16,7 +16,7 @@ import typing from cloudevents import exceptions as cloud_exceptions from cloudevents.abstract import AnyCloudEvent -from cloudevents.http import CloudEvent, is_binary +from cloudevents.http import is_binary from cloudevents.http.mappings import _marshaller_by_format, _obj_by_version from cloudevents.http.util import _json_or_string from cloudevents.sdk import converters, marshaller, types @@ -37,9 +37,9 @@ def to_json( def from_json( + event_type: typing.Type[AnyCloudEvent], data: typing.Union[str, bytes], data_unmarshaller: types.UnmarshallerType = None, - event_type: typing.Type[AnyCloudEvent] = CloudEvent, ) -> AnyCloudEvent: """ Cast json encoded data into an CloudEvent @@ -58,10 +58,10 @@ def from_json( def from_http( + event_type: typing.Type[AnyCloudEvent], headers: typing.Dict[str, str], data: typing.Union[str, bytes, None], data_unmarshaller: types.UnmarshallerType = None, - event_type: typing.Type[AnyCloudEvent] = CloudEvent, ) -> AnyCloudEvent: """ Unwrap a CloudEvent (binary or structured) from an HTTP request. diff --git a/cloudevents/http/http_methods.py b/cloudevents/http/http_methods.py index 20b9d51..61fc1ab 100644 --- a/cloudevents/http/http_methods.py +++ b/cloudevents/http/http_methods.py @@ -38,7 +38,7 @@ def from_http( e.g. lambda x: x or lambda x: json.loads(x) :type data_unmarshaller: types.UnmarshallerType """ - return _abstract_from_http(headers, data, data_unmarshaller, event_type=CloudEvent) + return _abstract_from_http(CloudEvent, headers, data, data_unmarshaller) # backwards compatibility diff --git a/cloudevents/http/json_methods.py b/cloudevents/http/json_methods.py index 01fb42e..1f04431 100644 --- a/cloudevents/http/json_methods.py +++ b/cloudevents/http/json_methods.py @@ -32,7 +32,7 @@ def from_json( :type data_unmarshaller: typing.Callable :returns: CloudEvent representing given cloudevent json object """ - return _abstract_from_json(data, data_unmarshaller, event_type=CloudEvent) + return _abstract_from_json(CloudEvent, data, data_unmarshaller) # backwards compatibility