| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,8 +63,8 @@ class Gitlab: | |||
| 63 | 63 | pagination: Can be set to 'keyset' to use keyset pagination | |
| 64 | 64 | order_by: Set order_by globally | |
| 65 | 65 | 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. | ||
| 68 | 68 | """ | |
| 69 | 69 | ||
| 70 | 70 | def __init__( | |
@@ -624,6 +624,7 @@ def http_request( | |||
| 624 | 624 | files: Optional[Dict[str, Any]] = None, | |
| 625 | 625 | timeout: Optional[float] = None, | |
| 626 | 626 | obey_rate_limit: bool = True, | |
| 627 | + retry_transient_errors: Optional[bool] = None, | ||
| 627 | 628 | max_retries: int = 10, | |
| 628 | 629 | **kwargs: Any, | |
| 629 | 630 | ) -> requests.Response: | |
@@ -642,6 +643,8 @@ def http_request( | |||
| 642 | 643 | timeout: The timeout, in seconds, for the request | |
| 643 | 644 | obey_rate_limit: Whether to obey 429 Too Many Request | |
| 644 | 645 | responses. Defaults to True. | |
| 646 | + retry_transient_errors: Whether to retry after 500, 502, 503, 504 | ||
| 647 | + or 52x responses. Defaults to False. | ||
| 645 | 648 | max_retries: Max retries after 429 or transient errors, | |
| 646 | 649 | set to -1 to retry forever. Defaults to 10. | |
| 647 | 650 | **kwargs: Extra options to send to the server (e.g. sudo) | |
@@ -679,14 +682,13 @@ def http_request( | |||
| 679 | 682 | # If timeout was passed into kwargs, allow it to override the default | |
| 680 | 683 | if timeout is None: | |
| 681 | 684 | timeout = opts_timeout | |
| 685 | + if retry_transient_errors is None: | ||
| 686 | + retry_transient_errors = self.retry_transient_errors | ||
| 682 | 687 | ||
| 683 | 688 | # We need to deal with json vs. data when uploading files | |
| 684 | 689 | json, data, content_type = self._prepare_send_data(files, post_data, raw) | |
| 685 | 690 | opts["headers"]["Content-type"] = content_type | |
| 686 | 691 | ||
| 687 | - retry_transient_errors = kwargs.get( | ||
| 688 | - "retry_transient_errors", self.retry_transient_errors | ||
| 689 | - ) | ||
| 690 | 692 | cur_retries = 0 | |
| 691 | 693 | while True: | |
| 692 | 694 | try: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments