Skip to content
Snippets Groups Projects
Commit 2bf4b27e authored by Eva Bardou's avatar Eva Bardou :frog: Committed by Yoann Schneider
Browse files

Remove `SSLError` specific handler during image downloading

parent c832f4de
No related branches found
No related tags found
1 merge request!507Remove `SSLError` specific handler during image downloading
Pipeline #162803 passed
......@@ -115,20 +115,6 @@ def download_image(url: str) -> Image:
)
else:
raise e
except requests.exceptions.SSLError:
logger.warning(
"An SSLError occurred during image download, retrying with a weaker and unsafe SSL configuration"
)
# Saving current ciphers
previous_ciphers = requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS
# Downgrading ciphers to download the image
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = "ALL:@SECLEVEL=1"
resp = _retried_request(url)
# Restoring previous ciphers
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = previous_ciphers
# Preprocess the image and prepare it for classification
image = Image.open(BytesIO(resp.content))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment