Skip to content

Commit 3431887

Browse files
committed
fix: avoid passing redundant arguments to API
1 parent 0353bd4 commit 3431887

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gitlab/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class Gitlab:
5656
pagination: Can be set to 'keyset' to use keyset pagination
5757
order_by: Set order_by globally
5858
user_agent: A custom user agent to use for making HTTP requests.
59-
retry_transient_errors: Whether to retry after 500, 502, 503, or
60-
504 responses. Defaults to False.
59+
retry_transient_errors: Whether to retry after 500, 502, 503, 504
60+
or 52x responses. Defaults to False.
6161
"""
6262

6363
def __init__(
@@ -617,6 +617,7 @@ def http_request(
617617
files: Optional[Dict[str, Any]] = None,
618618
timeout: Optional[float] = None,
619619
obey_rate_limit: bool = True,
620+
retry_transient_errors: Optional[bool] = None,
620621
max_retries: int = 10,
621622
**kwargs: Any,
622623
) -> requests.Response:
@@ -635,6 +636,8 @@ def http_request(
635636
timeout: The timeout, in seconds, for the request
636637
obey_rate_limit: Whether to obey 429 Too Many Request
637638
responses. Defaults to True.
639+
retry_transient_errors: Whether to retry after 500, 502, 503, 504
640+
or 52x responses. Defaults to False.
638641
max_retries: Max retries after 429 or transient errors,
639642
set to -1 to retry forever. Defaults to 10.
640643
**kwargs: Extra options to send to the server (e.g. sudo)
@@ -672,14 +675,13 @@ def http_request(
672675
# If timeout was passed into kwargs, allow it to override the default
673676
if timeout is None:
674677
timeout = opts_timeout
678+
if retry_transient_errors is None:
679+
retry_transient_errors = self.retry_transient_errors
675680

676681
# We need to deal with json vs. data when uploading files
677682
json, data, content_type = self._prepare_send_data(files, post_data, raw)
678683
opts["headers"]["Content-type"] = content_type
679684

680-
retry_transient_errors = kwargs.get(
681-
"retry_transient_errors", self.retry_transient_errors
682-
)
683685
cur_retries = 0
684686
while True:
685687
try:

0 commit comments

Comments
 (0)