| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,8 +56,8 @@ class Gitlab: | |||
| 56 | 56 | pagination: Can be set to 'keyset' to use keyset pagination | |
| 57 | 57 | order_by: Set order_by globally | |
| 58 | 58 | 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. | ||
| 61 | 61 | """ | |
| 62 | 62 | ||
| 63 | 63 | def __init__( | |
@@ -617,6 +617,7 @@ def http_request( | |||
| 617 | 617 | files: Optional[Dict[str, Any]] = None, | |
| 618 | 618 | timeout: Optional[float] = None, | |
| 619 | 619 | obey_rate_limit: bool = True, | |
| 620 | + retry_transient_errors: Optional[bool] = None, | ||
| 620 | 621 | max_retries: int = 10, | |
| 621 | 622 | **kwargs: Any, | |
| 622 | 623 | ) -> requests.Response: | |
@@ -635,6 +636,8 @@ def http_request( | |||
| 635 | 636 | timeout: The timeout, in seconds, for the request | |
| 636 | 637 | obey_rate_limit: Whether to obey 429 Too Many Request | |
| 637 | 638 | responses. Defaults to True. | |
| 639 | + retry_transient_errors: Whether to retry after 500, 502, 503, 504 | ||
| 640 | + or 52x responses. Defaults to False. | ||
| 638 | 641 | max_retries: Max retries after 429 or transient errors, | |
| 639 | 642 | set to -1 to retry forever. Defaults to 10. | |
| 640 | 643 | **kwargs: Extra options to send to the server (e.g. sudo) | |
@@ -672,14 +675,13 @@ def http_request( | |||
| 672 | 675 | # If timeout was passed into kwargs, allow it to override the default | |
| 673 | 676 | if timeout is None: | |
| 674 | 677 | timeout = opts_timeout | |
| 678 | + if retry_transient_errors is None: | ||
| 679 | + retry_transient_errors = self.retry_transient_errors | ||
| 675 | 680 | ||
| 676 | 681 | # We need to deal with json vs. data when uploading files | |
| 677 | 682 | json, data, content_type = self._prepare_send_data(files, post_data, raw) | |
| 678 | 683 | opts["headers"]["Content-type"] = content_type | |
| 679 | 684 | ||
| 680 | - retry_transient_errors = kwargs.get( | ||
| 681 | - "retry_transient_errors", self.retry_transient_errors | ||
| 682 | - ) | ||
| 683 | 685 | cur_retries = 0 | |
| 684 | 686 | while True: | |
| 685 | 687 | try: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments