我在 python 中使用以下代码发送请求
def get(self, url):
response = None
try:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_1 | ssl.PROTOCOL_TLSv1_2)
if url.lower().startswith('https'):
response = ur.urlopen(url, context=ctx)
return response.read()
else:
raise ValueError from None
except Exception as ex:
print(str(ex))