1
I’m having a big problem with Django requests. In the last few months I upgraded to version 2.0 of Django, and I’m updating all libs.
I noticed that this impacted several scripts that I had, mainly those that talk with https. For example, my Pushnotification stopped working, my script that downloads images from social networks stopped working and everything. For all these errors I get the following error message:
requests.exceptions.SSLError: HTTPSConnectionPool(host='yt3.ggpht.com', port=443): Max retries exceeded with url: /a-/XXXXXXXXXXXXXXXXXXj-k-no (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
Follow my version of requests:
requests==2.18.4
In this particular example, it’s me trying to download an avatar from Youtube.
EDIT
Follow an excerpt from the code. I tried to use the verify=False
but did not help, outside that is not recommended, the very Warning warns..
from django.core.files.base import ContentFile
import requests
response = requests.get('https://yt3.ggpht.com/-Tn306TYaqpw/AAAAAAAAAAI/AAAAAAAAHOw/XsdeQ5H6Bds/s176-nd-c-c0xffffffff-rj-k-no/photo.jpg', verify=False)
yt_avatar = ContentFile(response.content)
Trying with the verify=False
the error return is different but means the same thing..
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)
So I took the test and I only get a Warning saying it’s not recommended. But it doesn’t work, the return is different but it’s the same meaning...
– Guilherme IA
What is your version of python? If it is 2.x, take a look here.
– Vitor Hugo
My mole is 3.x
– Guilherme IA