文档

超时机制

更新时间:

新版SDK超时机制

新版 SDK 将 Request 中的业务参数和这种运行时参数分开设置避免用户混淆,所以超时的设置新版 SDK 的超时机制为 RuntimeOption -> Config 设置 -> 默认,优先级依次降低;默认连接超时为5秒,读超时为10秒:

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',
    read_timeout=10000,  # 读超时时间 单位毫秒(ms)
    connect_timeout=5000  # 连接超时 单位毫秒(ms)
)

RuntimeOptions(
    read_timeout=10000,  # 读超时时间 单位毫秒(ms)
    connect_timeout=5000  # 连接超时 单位毫秒(ms)
)
  • 本页导读 (1)
文档反馈