diff --git a/README.md b/README.md index 87a263a..9d2c4a7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,13 @@ Unofficial Python implementation for [CloudEvents](https://cloudevents.io/) v1.0 Check out the [CloudEvents spec](https://github.com/cloudevents/spec/blob/v1.0/spec.md). This package has no dependencies beyond the Python standard library with the base install. -Optionally depends on the `avro` package for Avro encode/decode functionality. +Optionally depends on the `avro` package for Avro encode/decode functionality. + +## News + +### 0.2.2 - (*2020-09-29*) + +* First public release. ## Install diff --git a/setup.py b/setup.py index a81e6b8..d761fef 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name='spce', - version='0.2.1', + version='0.2.2', packages=['spce'], url='https://github.com/scaleplandev/spce-python', license='Apache 2.0', diff --git a/spce/json.py b/spce/json.py index d3f0974..5a151de 100644 --- a/spce/json.py +++ b/spce/json.py @@ -33,7 +33,7 @@ def encode(cls, event: CloudEvent): kvs.append('"%s":%s' % (attr, encoder.encode(value))) if event._data: if event._has_binary_data: - kvs.append('"data_b64":%s' % encoder.encode(b64encode(event._data).decode())) + kvs.append('"data_base64":%s' % encoder.encode(b64encode(event._data).decode())) else: kvs.append('"data":%s' % encoder.encode(event._data)) return "{%s}" % ",".join(kvs) @@ -41,8 +41,8 @@ def encode(cls, event: CloudEvent): @classmethod def decode(cls, text: str) -> CloudEvent: d = json.loads(text) - if "data_b64" in d: - d["data"] = b64decode(d["data_b64"]) - del d["data_b64"] + if "data_base64" in d: + d["data"] = b64decode(d["data_base64"]) + del d["data_base64"] return CloudEvent(**d) diff --git a/tests/json_test.py b/tests/json_test.py index 6081abf..84089e6 100644 --- a/tests/json_test.py +++ b/tests/json_test.py @@ -96,7 +96,7 @@ def test_encode_binary_data(self): "id": "1000", "specversion": "1.0", "datacontenttype": "application/octet-stream", - "data_b64": "AQIDBA==" + "data_base64": "AQIDBA==" } ''' self.assertEqual(json.loads(target), json.loads(encoded)) @@ -191,7 +191,7 @@ def test_decode_binary_data(self): "id": "1000", "specversion": "1.0", "datacontenttype": "application/octet-stream", - "data_b64": "AQIDBA==" + "data_base64": "AQIDBA==" } ''' target = CloudEvent(