Skip to content

Commit

Permalink
Fix Avro decode example.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuce committed Sep 29, 2020
1 parent 7464342 commit 3d014fe
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3d014fe

Please sign in to comment.