Skip to content

Commit 94c3254

Browse files
authored
fix: Support num_retries (#104)
* fix: num_retries method * fix: Added 408 for retries
1 parent f3daeba commit 94c3254

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ai21/http_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
DEFAULT_NUM_RETRIES = 0
2020
RETRY_BACK_OFF_FACTOR = 0.5
2121
TIME_BETWEEN_RETRIES = 1000
22-
RETRY_ERROR_CODES = (429, 500, 503)
22+
RETRY_ERROR_CODES = (408, 429, 500, 503)
2323
RETRY_METHOD_WHITELIST = ["GET", "POST", "PUT"]
2424

2525

@@ -46,7 +46,7 @@ def requests_retry_session(session, retries=0):
4646
connect=retries,
4747
backoff_factor=RETRY_BACK_OFF_FACTOR,
4848
status_forcelist=RETRY_ERROR_CODES,
49-
method_whitelist=frozenset(RETRY_METHOD_WHITELIST),
49+
allowed_methods=frozenset(RETRY_METHOD_WHITELIST),
5050
)
5151
adapter = HTTPAdapter(max_retries=retry)
5252
session.mount("https://", adapter)

0 commit comments

Comments
 (0)