def __init__(self, fallbackapp=None, endpoints=None, debug=False, options=None, default_error_handler=None): # Note fallback app needs to be a wsgi-compatible callable if fallbackapp: assert callable(fallbackapp), "Fallback app must be callable" self._fallbackapp = fallbackapp self._debug = debug if self._debug: _log.setLevel(logging.DEBUG) self._endpoints = [] if endpoints: assert isinstance(endpoints, list), "endpoints must be a list" for ep in endpoints: self.add_endpoint(ep) if not default_error_handler: default_error_handler = JsonErrorHandler self._options = Dictomatic({ "default_error_handler": default_error_handler, }) if options: assert isinstance(options, dict), "options must be of type dict" self._options.update(options) self.verify_options()