Spaces:
Running
Running
Download src/services/api/console_static.py from Leon4gr45/brain: direct link, hf CLI and curl.
- Browser
- Download file 527 Bytes
-
https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/src/services/api/console_static.py
- Command line
-
hf download hf://spaces/Leon4gr45/brain/src/services/api/console_static.py
-
curl -L -o console_static.py https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/src/services/api/console_static.py
527 Bytes
| from starlette.exceptions import HTTPException | |
| from starlette.staticfiles import StaticFiles | |
| def is_console_path(path: str) -> bool: | |
| return path == "/console" or path.startswith("/console/") | |
| class SPAStaticFiles(StaticFiles): | |
| async def get_response(self, path: str, scope): | |
| try: | |
| return await super().get_response(path, scope) | |
| except HTTPException as exc: | |
| if exc.status_code == 404: | |
| return await super().get_response("index.html", scope) | |
| raise exc | |