Fix proxy test: URL-encode httpx credentials, use Proxy object, improve error detail

DataImpulse username contains semicolons (;sessid.ID) that weren't being
URL-encoded in httpx_proxy_url, causing silent parse failures. Also use
httpx.Proxy object instead of raw string (consistent with httpx_proxy()),
and capture repr(e) so empty-message exceptions show their type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-10 08:57:25 +00:00
parent ed0a027448
commit f6d5fb27e1
2 changed files with 8 additions and 6 deletions

View file

@ -129,8 +129,9 @@ def httpx_proxy_url(cfg: dict, session_id: Optional[str] = None) -> Optional[str
"""Proxy URL for httpx.AsyncClient(proxy=...). None when disabled."""
if not is_enabled(cfg):
return None
from urllib.parse import quote
user, pwd = _build_auth(cfg, session_id)
return f"http://{user}:{pwd}@{cfg['host']}:{cfg['port']}"
return f"http://{quote(user, safe='')}:{quote(pwd, safe='')}@{cfg['host']}:{cfg['port']}"
def direct_httpx_proxy(db):