| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 19ab07d commit 3b49e4d
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -675,19 +675,33 @@ def http_request( | |||
| 675 | 675 | json, data, content_type = self._prepare_send_data(files, post_data, raw) | |
| 676 | 676 | opts["headers"]["Content-type"] = content_type | |
| 677 | 677 | ||
| 678 | + retry_transient_errors = kwargs.get( | ||
| 679 | + "retry_transient_errors", self.retry_transient_errors | ||
| 680 | + ) | ||
| 678 | 681 | cur_retries = 0 | |
| 679 | 682 | while True: | |
| 680 | - result = self.session.request( | ||
| 681 | - method=verb, | ||
| 682 | - url=url, | ||
| 683 | - json=json, | ||
| 684 | - data=data, | ||
| 685 | - params=params, | ||
| 686 | - timeout=timeout, | ||
| 687 | - verify=verify, | ||
| 688 | - stream=streamed, | ||
| 689 | - **opts, | ||
| 690 | - ) | ||
| 683 | + try: | ||
| 684 | + result = self.session.request( | ||
| 685 | + method=verb, | ||
| 686 | + url=url, | ||
| 687 | + json=json, | ||
| 688 | + data=data, | ||
| 689 | + params=params, | ||
| 690 | + timeout=timeout, | ||
| 691 | + verify=verify, | ||
| 692 | + stream=streamed, | ||
| 693 | + **opts, | ||
| 694 | + ) | ||
| 695 | + except requests.ConnectionError: | ||
| 696 | + if retry_transient_errors and ( | ||
| 697 | + max_retries == -1 or cur_retries < max_retries | ||
| 698 | + ): | ||
| 699 | + wait_time = 2 ** cur_retries * 0.1 | ||
| 700 | + cur_retries += 1 | ||
| 701 | + time.sleep(wait_time) | ||
| 702 | + continue | ||
| 703 | + | ||
| 704 | + raise | ||
| 691 | 705 | ||
| 692 | 706 | self._check_redirects(result) | |
| 693 | 707 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments