Spaces:
Configuration error
Configuration error
Download openhands/server/routes/security.py from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 963 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/server/routes/security.py
- Command line
-
hf download hf://spaces/flyingdarkdev/README/openhands/server/routes/security.py
-
curl -L -o security.py https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/openhands/server/routes/security.py
963 Bytes
| from fastapi import ( | |
| APIRouter, | |
| HTTPException, | |
| Request, | |
| Response, | |
| status, | |
| ) | |
| app = APIRouter(prefix='/api/conversations/{conversation_id}') | |
| async def security_api(request: Request) -> Response: | |
| """Catch-all route for security analyzer API requests. | |
| Each request is handled directly to the security analyzer. | |
| Args: | |
| request (Request): The incoming FastAPI request object. | |
| Returns: | |
| Response: The response from the security analyzer. | |
| Raises: | |
| HTTPException: If the security analyzer is not initialized. | |
| """ | |
| if not request.state.conversation.security_analyzer: | |
| raise HTTPException( | |
| status_code=status.HTTP_404_NOT_FOUND, | |
| detail='Security analyzer not initialized', | |
| ) | |
| return await request.state.conversation.security_analyzer.handle_api_request( | |
| request | |
| ) | |