divbrowse.lib.utils

Module Contents

Classes

StrictEncoder

Extensible JSON <http://json.org> encoder for Python data structures.

ORJSONEncoder

Functions

print_error(msg)

Attributes

RED

RESET

divbrowse.lib.utils.RED = 
divbrowse.lib.utils.RESET = 
divbrowse.lib.utils.print_error(msg)
exception divbrowse.lib.utils.ApiError(message, status_code=None, payload=None)

Bases: Exception

Common base class for all non-exit exceptions.

status_code = 200
to_dict()
class divbrowse.lib.utils.StrictEncoder(*args, **kwargs)

Bases: simplejson.JSONEncoder

Extensible JSON <http://json.org> encoder for Python data structures.

Supports the following objects and types by default:

Python

JSON

dict, namedtuple

object

list, tuple

array

str, unicode

string

int, long, float

number

True

true

False

false

None

null

To extend this to recognize other objects, subclass and implement a .default() method with another method that returns a serializable object for o if possible, otherwise it should call the superclass implementation (to raise TypeError).

class divbrowse.lib.utils.ORJSONEncoder(**kwargs)
encode(obj)