superduper
superduper copied to clipboard
Support `base64` encoding of `bytes` as `str` in `Document`
Add an optional parameter bytes_encoding
to Document.encode
so that we can send encoded Document
instances
via REST interfaces.
bytes_encoding
can take 2 values: "bytes"
and "base64"
- i.e. config.BytesEncoding
Tasks
- [x] Add override of
CFG.bytes_encoding
in:- [x]
Encoder.encode
- [x]
Encoder.decode
- [x]
Encodable.encode
- [x]
- [x] Add override of
CFG.bytes_encoding
inDocument.encode
andDocument.decode
- [x] Unittest checking
Document({'img': pil_image(PIL.Image.open(...))}).encode(bytes_encoding=BytesEncoding.base64)