Skip to content

The agent that grows with you

refactor(telegram): import platform_ssl_context at module top in telegram_network

kshitijk4poor3c5c402de105
diff --git a/plugins/platforms/telegram/telegram_network.py b/plugins/platforms/telegram/telegram_network.py
index 6421fda318d..8a21799fbd0 100644
--- a/plugins/platforms/telegram/telegram_network.py
+++ b/plugins/platforms/telegram/telegram_network.py
@@ -11,6 +11,8 @@ from typing import Iterable, Optional
import httpx
+from agent.ssl_verify import platform_ssl_context
+
logger = logging.getLogger(__name__)
_TELEGRAM_API_HOST = "api.telegram.org"
@@ -265,7 +267,6 @@ async def discover_fallback_ips() -> list[str]:
IP is the most reliable path to api.telegram.org and a transient primary-path failure should be retried
against the same address via the IP-rewrite path before the seed list is consulted (#14520).
"""
- from agent.ssl_verify import platform_ssl_context
async with httpx.AsyncClient(timeout=httpx.Timeout(_DOH_TIMEOUT), verify=platform_ssl_context()) as client:
system_dns_task = asyncio.ensure_future(asyncio.to_thread(_resolve_system_dns))
results = await asyncio.gather(*[_query_doh_provider(client, p) for p in _DOH_PROVIDERS], return_exceptions=True)