Skip to content

Commit 887852d

Browse files
Liora Milbaumnejch
authored andcommitted
refactor: Moving RETRYABLE_TRANSIENT_ERROR_CODES to const
1 parent 985b971 commit 887852d

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

gitlab/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"{source!r} to {target!r}"
2323
)
2424

25-
RETRYABLE_TRANSIENT_ERROR_CODES = [500, 502, 503, 504] + list(range(520, 531))
2625

2726
# https://docs.gitlab.com/ee/api/#offset-based-pagination
2827
_PAGINATION_URL = (
@@ -781,7 +780,7 @@ def http_request(
781780
return result
782781

783782
if (429 == result.status_code and obey_rate_limit) or (
784-
result.status_code in RETRYABLE_TRANSIENT_ERROR_CODES
783+
result.status_code in gitlab.const.RETRYABLE_TRANSIENT_ERROR_CODES
785784
and retry_transient_errors
786785
):
787786
# Response headers documentation:

gitlab/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ class SearchScope(GitlabEnum):
131131

132132
USER_AGENT: str = f"{__title__}/{__version__}"
133133

134+
RETRYABLE_TRANSIENT_ERROR_CODES = [500, 502, 503, 504] + list(range(520, 531))
135+
134136
__all__ = [
135137
"AccessLevel",
136138
"Visibility",

tests/unit/test_gitlab_http_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import responses
77

88
from gitlab import GitlabHttpError, GitlabList, GitlabParsingError, RedirectError
9-
from gitlab.client import RETRYABLE_TRANSIENT_ERROR_CODES
9+
from gitlab.const import RETRYABLE_TRANSIENT_ERROR_CODES
1010
from tests.unit import helpers
1111

1212

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy