From 7a6964bd72973084f386be539c96868f8f9a5852 Mon Sep 17 00:00:00 2001 From: SimonTaurus Date: Thu, 7 May 2026 04:20:13 +0200 Subject: [PATCH] fix: apply ApiGateway httpx patch at module import time Ensures the transport is active for ALL Prefect API calls (e.g. block storage, task scheduling), not just those inside deploy(). --- src/osw/utils/workflow.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osw/utils/workflow.py b/src/osw/utils/workflow.py index b628599..5a8c3f4 100644 --- a/src/osw/utils/workflow.py +++ b/src/osw/utils/workflow.py @@ -24,9 +24,15 @@ import osw.model.entity as model from osw.auth import CredentialManager from osw.core import OSW +from osw.utils._httpx_gateway import _install as _install_gateway_hook from osw.utils.wiki import get_full_title from osw.wtsite import WtSite +# Auto-patch httpx at import time if PREFECT_API_URL is an ApiGateway URL. +# This ensures the transport is active for ALL Prefect API calls, not just +# those inside deploy(). The patch is lazy — no MW login until first request. +_install_gateway_hook() + # ------------------------------ CONNECTION --------------------- class ConnectionSettings(BaseModel):