代理配置
新版SDK代理配置
新版本 SDK 同样可以通过环境变量:
HTTP_PROXY 或者 http_proxy
HTTPS_PROXY或者 https_proxy
支持代理或者通过 Config 在初始化 Client 阶段设置请求的代理可以设置,新版 SDK 还支持通过运行时参数配置当前请求的代理优先级:RuntimeOption -> Client > 环境变量:
from alibabacloud_tea_openapi.models import Config
from alibabacloud_tea_util.models import RuntimeOptions
config = Config(
access_key_id='<ACCESS-KEY-ID>',
access_key_secret='<ACCESS-KEY-SECRET>',
region_id='cn-hangzhou',
http_proxy='http://127.0.0.1:9898',
https_proxy='http://user:password@127.0.0.1:8989'
)
RuntimeOptions(
http_proxy='http://127.0.0.1:9898',
https_proxy='http://user:password@127.0.0.1:8989'
)