Skip to content

Commit ba7692a

Browse files
authored
Merge pull request #1965 from python-gitlab/fix/redundant-args-api
fix: avoid passing redundant arguments to API
2 parents 07a16af + 3431887 commit ba7692a

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
@@ -63,8 +63,8 @@ class Gitlab:
6363
pagination: Can be set to 'keyset' to use keyset pagination
6464
order_by: Set order_by globally
6565
user_agent: A custom user agent to use for making HTTP requests.
66-
retry_transient_errors: Whether to retry after 500, 502, 503, or
67-
504 responses. Defaults to False.
66+
retry_transient_errors: Whether to retry after 500, 502, 503, 504
67+
or 52x responses. Defaults to False.
6868
"""
6969

7070
def __init__(
@@ -624,6 +624,7 @@ def http_request(
624624
files: Optional[Dict[str, Any]] = None,
625625
timeout: Optional[float] = None,
626626
obey_rate_limit: bool = True,
627+
retry_transient_errors: Optional[bool] = None,
627628
max_retries: int = 10,
628629
**kwargs: Any,
629630
) -> requests.Response:
@@ -642,6 +643,8 @@ def http_request(
642643
timeout: The timeout, in seconds, for the request
643644
obey_rate_limit: Whether to obey 429 Too Many Request
644645
responses. Defaults to True.
646+
retry_transient_errors: Whether to retry after 500, 502, 503, 504
647+
or 52x responses. Defaults to False.
645648
max_retries: Max retries after 429 or transient errors,
646649
set to -1 to retry forever. Defaults to 10.
647650
**kwargs: Extra options to send to the server (e.g. sudo)
@@ -679,14 +682,13 @@ def http_request(
679682
# If timeout was passed into kwargs, allow it to override the default
680683
if timeout is None:
681684
timeout = opts_timeout
685+
if retry_transient_errors is None:
686+
retry_transient_errors = self.retry_transient_errors
682687

683688
# We need to deal with json vs. data when uploading files
684689
json, data, content_type = self._prepare_send_data(files, post_data, raw)
685690
opts["headers"]["Content-type"] = content_type
686691

687-
retry_transient_errors = kwargs.get(
688-
"retry_transient_errors", self.retry_transient_errors
689-
)
690692
cur_retries = 0
691693
while True:
692694
try:

0 commit comments

Comments
 (0)