Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /li-boxuan_OpenDevin /openhands /server /dependencies.py
| # IMPORTANT: LEGACY V0 CODE | |
| # This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1. | |
| # OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to: | |
| # - V1 agentic core (SDK): https://github.com/OpenHands/software-agent-sdk | |
| # - V1 application server (in this repo): openhands/app_server/ | |
| # Unless you are working on deprecation, please avoid extending this legacy file and consult the V1 codepaths above. | |
| # Tag: Legacy-V0 | |
| # This module belongs to the old V0 web server. The V1 application server lives under openhands/app_server/. | |
| import os | |
| from fastapi import Depends, HTTPException, status | |
| from fastapi.security import APIKeyHeader | |
| _SESSION_API_KEY = os.getenv('SESSION_API_KEY') | |
| _SESSION_API_KEY_HEADER = APIKeyHeader(name='X-Session-API-Key', auto_error=False) | |
| def check_session_api_key( | |
| session_api_key: str | None = Depends(_SESSION_API_KEY_HEADER), | |
| ): | |
| """Check the session API key and throw an exception if incorrect. Having this as a dependency | |
| means it appears in OpenAPI Docs | |
| """ | |
| if session_api_key != _SESSION_API_KEY: | |
| raise HTTPException(status.HTTP_401_UNAUTHORIZED) | |
| def get_dependencies() -> list[Depends]: | |
| result = [] | |
| if _SESSION_API_KEY: | |
| result.append(Depends(check_session_api_key)) | |
| return result | |
Xet Storage Details
- Size:
- 1.4 kB
- Xet hash:
- 373d112edc45f2dc57796f9c0a98aa34b5f6f087b8d7650caca71bf5edbc2819
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.