Skip to content

Commit c2f9db2

Browse files
authored
feat: add connection and read timeout for HTTP requests (#76)
Signed-off-by: yehao <[email protected]>
1 parent 44cbdea commit c2f9db2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

opengemini_client/client_impl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def _request(self, method, server_url, url_path, headers=None, body=None, params
142142

143143
req = requests.Request(method, full_url, data=body, headers=headers, params=params)
144144
prepared = req.prepare()
145-
resp = self.session.send(prepared)
145+
timeout = (self.config.connection_timeout.seconds, self.config.timeout.seconds)
146+
resp = self.session.send(prepared, timeout=timeout)
146147
if not 200 <= resp.status_code < 300:
147148
raise HTTPError(f"request error resp, code: {resp.status_code}, body: {resp.text}")
148149
return resp

0 commit comments

Comments
 (0)