跳到正文
← 今日

Anthropic ·

DefaultHttpxClient 优先采用显式代理设置

使用 DefaultHttpxClient 或对应的异步客户端时,proxy= 现在用于每次请求,trust_env=False 会忽略代理环境变量。

之前设置 proxy= 时,NO_PROXY 中的主机会直接连接。
现在设置 proxy= 后,NO_PROXY 中的主机会经过代理。

你需要知道的

  • 设置 proxy= 后,每次请求都会使用该代理。
  • trust_env=False 会忽略四个代理环境变量。
  • 可用 mounts 让特定主机不使用代理。

原文怎么说

Features * api: add Google-managed data controls for Google Cloud projects * api: add Google-managed data controls for user profiles * api: add support for compliance review cases, notices, and items Bug Fixes * client: honor proxy and trust_env when proxy variables are set DefaultHttpxClient and DefaultAsyncHttpxClient read HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY even when the caller passed proxy= or trust_env=False, and the variables won. Now proxy= is used for every request and the variables are not

github.com · 发布于 2026-11-25 · 打开原文 ↗