I’ll modify the __init__
method to add a timeout parameter with a default value of 60 seconds:
def __init__(self, base_url: str, timeout: int = 60):
"""
初始化客户端
Args:
base_url: 服务端基础URL,例如 "http://localhost:8000" 或 "https://expert-system.sdp.101.com"
timeout: HTTP请求超时时间,默认为60秒
"""
self.base_url = base_url.rstrip('/')
self.timeout = timeout
self.session = requests.Session()
self.session.headers.update({
'Content-Type': 'application/json',
'Accept': 'application/json'
})
Now I need to update the HTTP request to use this timeout parameter: