mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Provide httpx default context for OS-provided certs (#11505)
Co-authored-by: Pierrick Hymbert <pierrick.hymbert@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user