We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shouldn't this be handled by a 404 or just making it more graceful. Was also wondering whether the code should look like this:
class HookboxWebAPI(object): logger = logging.getLogger('HookboxRest') def __init__(self, api): self.api = api def __call__(self, environ, start_response): path = environ['PATH_INFO'] handler = getattr(self, 'render_' + path[1:], None) if not handler: start_response('404 Not Found', ()) return "Not Found" if not self.api.is_enabled(): start_response('200 Ok', ()) return json.dumps([False, { 'msg': "Rest api is disabled by configuration. (Please supply --rest-secret/-r option at start)" }]) try: form = get_form(environ) secret = form.pop('security_token', None) self.api.authorize(secret) return handler(form, start_response) except ExpectedException, e: start_response('200 Ok', []) self.logger.warn('REST Error: %s' % e) return json.dumps([False, {'msg': str(e) }]) except Exception, e: self.logger.warn('REST Error: %s', path, exc_info=True) start_response('500 Internal server error', []) return json.dumps([False, {'msg': str(e) }])
Thanks.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Shouldn't this be handled by a 404 or just making it more graceful. Was also wondering whether the code should look like this:
Thanks.
The text was updated successfully, but these errors were encountered: