Skip to content

Commit d9c9fac

Browse files
committed
support session.timeout_seconds
1 parent 44afec3 commit d9c9fac

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tls_client/sessions.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def __init__(
6363
# CookieJar containing all currently outstanding cookies set on this session
6464
self.cookies = cookiejar_from_dict({})
6565

66+
# Timeout
67+
self.timeout_seconds = 30
68+
6669
# --- Advanced Settings ----------------------------------------------------------------------------------------
6770

6871
# Examples:
@@ -275,7 +278,7 @@ def execute_request(
275278
json: Optional[dict] = None, # Optional[dict]
276279
allow_redirects: Optional[bool] = False,
277280
insecure_skip_verify: Optional[bool] = False,
278-
timeout_seconds: Optional[int] = 30,
281+
timeout_seconds: Optional[int] = None,
279282
proxy: Optional[dict] = None # Optional[dict[str, str]]
280283
):
281284
# --- URL ------------------------------------------------------------------------------------------------------
@@ -332,6 +335,11 @@ def execute_request(
332335
else:
333336
proxy = ""
334337

338+
# --- Timeout --------------------------------------------------------------------------------------------------
339+
# maximum time to wait
340+
341+
timeout_seconds = self.timeout_seconds or timeout_seconds
342+
335343
# --- Request --------------------------------------------------------------------------------------------------
336344
is_byte_request = isinstance(request_body, (bytes, bytearray))
337345
request_payload = {

0 commit comments

Comments
 (0)