Provide httpx default context for OS-provided certs (#11505)

Co-authored-by: Pierrick Hymbert <pierrick.hymbert@gmail.com>
This commit is contained in:
Ray Myers
2025-10-27 17:54:20 -05:00
committed by GitHub
parent 818f743dc7
commit 4decd8b3e9
20 changed files with 93 additions and 37 deletions

View File

@@ -9,6 +9,7 @@ from openhands.storage.local import LocalFileStore
from openhands.storage.memory import InMemoryFileStore
from openhands.storage.s3 import S3FileStore
from openhands.storage.web_hook import WebHookFileStore
from openhands.utils.http_session import httpx_verify_option
def get_file_store(
@@ -38,7 +39,10 @@ def get_file_store(
'SESSION_API_KEY'
)
client = httpx.Client(headers=file_store_web_hook_headers or {})
client = httpx.Client(
headers=file_store_web_hook_headers or {},
verify=httpx_verify_option(),
)
if file_store_web_hook_batch:
# Use batched webhook file store

View File

@@ -7,6 +7,7 @@ import tenacity
from openhands.core.logger import openhands_logger as logger
from openhands.storage.files import FileStore
from openhands.utils.async_utils import EXECUTOR
from openhands.utils.http_session import httpx_verify_option
# Constants for batching configuration
WEBHOOK_BATCH_TIMEOUT_SECONDS = 5.0
@@ -65,7 +66,7 @@ class BatchedWebHookFileStore(FileStore):
self.file_store = file_store
self.base_url = base_url
if client is None:
client = httpx.Client()
client = httpx.Client(verify=httpx_verify_option())
self.client = client
# Use provided values or default constants

View File

@@ -3,6 +3,7 @@ import tenacity
from openhands.storage.files import FileStore
from openhands.utils.async_utils import EXECUTOR
from openhands.utils.http_session import httpx_verify_option
class WebHookFileStore(FileStore):
@@ -34,7 +35,7 @@ class WebHookFileStore(FileStore):
self.file_store = file_store
self.base_url = base_url
if client is None:
client = httpx.Client()
client = httpx.Client(verify=httpx_verify_option())
self.client = client
def write(self, path: str, contents: str | bytes) -> None: