92f2111b26
The jsonutils.dumps() function returns bytes on Python 2 and Unicode oon Python 3. In some cases, we always want bytes. For example, a HTTP body must be bytes. This function avoids an condition call to .encode() depending on the type or on the Python version. For example: body = jsonutils.dumps(data) if isinstance(body, six.text_type): body = body.encode('utf-8') can be replaced with: body = jsonutils.dump_as_bytes(data) Change-Id: Ib9d8f1309982762b54d8a91b1f24f64d0ae6723a |
||
---|---|---|
.. | ||
tests | ||
__init__.py | ||
jsonutils.py | ||
msgpackutils.py |