

def _process_request(self, env, start_response):
    cmd = env['PATH_INFO'][1:]
    if cmd.endswith('/'):
        cmd = cmd[:(- 1)]
    params = parse_qs(env['QUERY_STRING'])
    try:
        if (cmd == 'series'):
            result = self._series(params)
        elif (cmd == 'list'):
            result = self._list(params)
        elif (cmd == 'properties'):
            result = self._properties(params)
        elif (cmd == 'insert'):
            result = self._insert(params)
        else:
            raise HttpNotFound()
        start_response('200 OK', [('content-type', 'application/json')])
        if (result is not None):
            return [ujson.dumps(result, double_precision=4)]
        return []
    except HttpError as e:
        start_response(('%s %s' % (start_response.code, e.msg)), [('content-type', 'application/json')])
        return []
    except Exception as e:
        logging.exception(self._log_context(env))
        start_response('500 Internal Server Error', [('content-type', 'application/json')])
        return []
    start_response('404 Not Found', [('content-type', 'application/json')])
    return []

dataset/ETHPy150Open agoragames/torus/torus/web.py Web._process_request/VarMisuse@203/264 `e`->`start_response`