I'm trying to get an image. Here is my code.
import io
import ssl
from urllib import request
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
item_image = "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/180px-Cat03.jpg"
f = io.BytesIO(request.urlopen(item_image,context=context).read())
When I try this code, warning appiers
C:\Users\xxx\AppData\Local\Temp\ipykernel_7868\2896668910.py:4: DeprecationWarning: ssl.PROTOCOL_TLSv1_2 is deprecated
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
I referred to this answer. Python3 "DeprecationWarning: ssl.PROTOCOL_TLSv1_2 is deprecated sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)" error
So I tried to replace "ssl.PROTOCOL_TLSv1_2" to "ssl.PROTOCOL_TLS_CLIENT" or "ssl.PROTOCOL_TLS_SERVER"
but both does not work. I've read document but I can not understand.https://docs.python.org/3/library/ssl.html
What shoud I do to clear this worning?
I just mentioned the above settings in this question but still if more code is required then tell me I'll update my question with that information. Thank you