| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1aae1db commit 4e32439
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -147,7 +147,8 @@ python-gitlab can automatically retry in such case, when | |||
| 147 | 147 | ``retry_transient_errors`` argument is set to ``True``. When enabled, | |
| 148 | 148 | HTTP error codes 500 (Internal Server Error), 502 (502 Bad Gateway), | |
| 149 | 149 | 503 (Service Unavailable), 504 (Gateway Timeout), and Cloudflare | |
| 150 | - errors (520-530) are retried. | ||
| 150 | + errors (520-530) are retried. `requests.exceptions.Timeout` are also | ||
| 151 | + handled. | ||
| 151 | 152 | ||
| 152 | 153 | Additionally, HTTP error code 409 (Conflict) is retried if the reason | |
| 153 | 154 | is a | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,7 +60,7 @@ class Gitlab: | |||
| 60 | 60 | order_by: Set order_by globally | |
| 61 | 61 | user_agent: A custom user agent to use for making HTTP requests. | |
| 62 | 62 | retry_transient_errors: Whether to retry after 500, 502, 503, 504 | |
| 63 | - or 52x responses. Defaults to False. | ||
| 63 | + or 52x responses, or after a request timeout. Defaults to False. | ||
| 64 | 64 | keep_base_url: keep user-provided base URL for pagination if it | |
| 65 | 65 | differs from response headers | |
| 66 | 66 | ||
@@ -665,7 +665,7 @@ def http_request( | |||
| 665 | 665 | obey_rate_limit: Whether to obey 429 Too Many Request | |
| 666 | 666 | responses. Defaults to True. | |
| 667 | 667 | retry_transient_errors: Whether to retry after 500, 502, 503, 504 | |
| 668 | - or 52x responses. Defaults to False. | ||
| 668 | + or 52x responses, or after a request timeout. Defaults to False. | ||
| 669 | 669 | max_retries: Max retries after 429 or transient errors, | |
| 670 | 670 | set to -1 to retry forever. Defaults to 10. | |
| 671 | 671 | extra_headers: Add and override HTTP headers for the request. | |
@@ -737,7 +737,11 @@ def http_request( | |||
| 737 | 737 | stream=streamed, | |
| 738 | 738 | **opts, | |
| 739 | 739 | ) | |
| 740 | - except (requests.ConnectionError, requests.exceptions.ChunkedEncodingError): | ||
| 740 | + except ( | ||
| 741 | + requests.ConnectionError, | ||
| 742 | + requests.exceptions.ChunkedEncodingError, | ||
| 743 | + requests.exceptions.Timeout, | ||
| 744 | + ): | ||
| 741 | 745 | if retry.handle_retry(): | |
| 742 | 746 | continue | |
| 743 | 747 | raise | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -146,6 +146,7 @@ def test_http_request_extra_headers(gl): | |||
| 146 | 146 | [ | |
| 147 | 147 | requests.ConnectionError("Connection aborted."), | |
| 148 | 148 | requests.exceptions.ChunkedEncodingError("Connection broken."), | |
| 149 | + requests.exceptions.Timeout("Request timed out."), | ||
| 149 | 150 | ], | |
| 150 | 151 | ) | |
| 151 | 152 | def test_http_request_with_retry_on_method_for_transient_network_failures( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments