From 3d014feed5d98bf27faf561bd529d2a6bc353851 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 29 Sep 2020 16:21:19 +0300 Subject: [PATCH] Fix Avro decode example. --- README.md | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9d2c4a7..df71b66 100644 --- a/README.md +++ b/README.md @@ -147,20 +147,11 @@ Decode an event in Avro: ```python from spce import Avro -text = """ - { - "type": "OximeterMeasured", - "source": "oximeter/123", - "id": "1000", - "specversion": "1.0", - "datacontenttype": "application/json", - "subject": "subject1", - "dataschema": "https://particlemetrics.com/schema", - "time": "2020-09-28T21:33:21Z", - "data": "{\"spo2\": 99})" - } -""" -decoded_event = Avro.decode(text) +encoded_event = \ + (b'\n\x08type\x06 OximeterMeasured\x0csource\x06\x18oximeter/123\x04id' + b'\x06\x081000\x16specversion\x06\x061.0\x1edatacontenttype\x06 application' + b'/json\x00\x0c\x18{"spo2": 99}') +decoded_event = Avro.decode(encoded_event) ``` ## License