Skip to content

Commit

Permalink
enable http request retry under proxy (#1022)
Browse files Browse the repository at this point in the history
* enable http request retry under proxy

* Update src/huggingface_hub/file_download.py

Co-authored-by: zhengxin.1999 <zhengxin.1999@bytedance.com>
Co-authored-by: Lucain <lucainp@gmail.com>
  • Loading branch information
3 people authored Aug 31, 2022
1 parent 4af799e commit c03bd29
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/huggingface_hub/file_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ def _request_wrapper(
method=method.upper(), url=url, timeout=timeout, **params
)
success = True
except requests.exceptions.ConnectTimeout as err:
except (
requests.exceptions.ConnectTimeout,
requests.exceptions.ProxyError,
) as err:
if tries > max_retries:
raise err
else:
Expand Down

0 comments on commit c03bd29

Please # to comment.