INNER CODE UNIT · Python
application
gobii-ai/gobii-platform · sandbox_server/server/app.py:26
def application(environ: Dict[str, Any], start_response: Callable) -> list[bytes]:
started_at = time.monotonic()
path = environ.get("PATH_INFO", "") or ""
method = environ.get("REQUEST_METHOD", "GET").upper()
if path.rstrip("/") == "/healthz":
return _json_response(start_response, "200 OK", {"status": "ok"})
if method != "POST":
logger.warning(
"Sandbox request rejected path=%s method=%s http_status=405 duration_ms=%s",
path,
method,
_elapsed_ms(started_at),
)
return _json_response(start_response, "405 Method Not Allowed", {"status": "error", "message": "POST only."})
auth_error = _require_auth(environ)