0

I want to download a file from a website but when i use urlopen i have an error :

url= 'https://dpdhl.com/content/dam/dpdhl/en/media-center/investors/documents/statbooks/2021/DPDHL-Statbook-Q4-FY-2020.xlsx'

urll = urllib.request.urlopen(url)

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'dpdhl.com'. (_ssl.c:1123)>

Someone can help me. Best regards

1 Answers1

0

This is not an error in your code. HTTPS uses SSL (Secure Socket Layer) and the target website provided an invalid certificate. Change https to http and it will work, but you lose the security of SSL.

Attersson
  • 4,755
  • 1
  • 15
  • 29
  • Hello, Thank you for your answer. I changed https to http, i don't have error but i don't have response, the script is always running. – Hamza DAHMOUNI Mar 19 '22 at 12:57