divbrowse.lib.utils¶
Module Contents¶
Classes¶
Extensible JSON <http://json.org> encoder for Python data structures. |
|
Functions¶
|
Attributes¶
- divbrowse.lib.utils.RED = [31m¶
- divbrowse.lib.utils.RESET = [0m¶
- divbrowse.lib.utils.print_error(msg)¶
- exception divbrowse.lib.utils.ApiError(message, status_code=None, payload=None)¶
Bases:
ExceptionCommon base class for all non-exit exceptions.
- status_code = 200¶
- to_dict()¶
- class divbrowse.lib.utils.StrictEncoder(*args, **kwargs)¶
Bases:
simplejson.JSONEncoderExtensible 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 foroif possible, otherwise it should call the superclass implementation (to raiseTypeError).