The zaqar.transport.utils module

exception MalformedJSON

Bases: exceptions.ValueError

JSON string is not valid.

exception OverflowedJSONInteger

Bases: exceptions.OverflowError

JSON integer is too large.

read_json(stream, len)

Like json.load, but converts ValueError to MalformedJSON upon failure.

Parameters:
  • stream – a file-like object
  • len – the number of bytes to read from stream
to_json(obj)

Like json.dumps, but outputs a UTF-8 encoded string.

Parameters:obj – a JSON-serializable object

Previous topic

The zaqar.transport.base module

Next topic

The zaqar.transport.validation module

Project Source

This Page