[file_utils] do not gobble certain kinds of requests.ConnectionError (#10235)
* do not gobble certain kinds of requests.ConnectionError * Apply review comments Co-authored-by: Lysandre <lysandre.debut@reseau.eseo.fr>
This commit is contained in:
0
examples/legacy/token-classification/run_tf_ner.py
Normal file → Executable file
0
examples/legacy/token-classification/run_tf_ner.py
Normal file → Executable file
@@ -1312,8 +1312,12 @@ def get_from_cache(
|
|||||||
# between the HEAD and the GET (unlikely, but hey).
|
# between the HEAD and the GET (unlikely, but hey).
|
||||||
if 300 <= r.status_code <= 399:
|
if 300 <= r.status_code <= 399:
|
||||||
url_to_download = r.headers["Location"]
|
url_to_download = r.headers["Location"]
|
||||||
|
except (requests.exceptions.SSLError, requests.exceptions.ProxyError):
|
||||||
|
# Actually raise for those subclasses of ConnectionError
|
||||||
|
raise
|
||||||
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout):
|
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout):
|
||||||
# etag is already None
|
# Otherwise, our Internet connection is down.
|
||||||
|
# etag is None
|
||||||
pass
|
pass
|
||||||
|
|
||||||
filename = url_to_filename(url, etag)
|
filename = url_to_filename(url, etag)
|
||||||
|
|||||||
Reference in New Issue
Block a user