Skip to content

Commit b8e35b6

Browse files
committed
🎨避免访问https时ssl证书校验失败
1 parent 2f33cb2 commit b8e35b6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

client/util/api/httpclient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
""" http client
99
"""
1010

11+
import ssl
1112
import json
1213
import logging
1314

@@ -40,7 +41,7 @@ def request(url, headers, param=None, body=None, method="POST"):
4041
try:
4142
request = Request(url=url, data=body, headers=headers)
4243
request.get_method = lambda: method.upper()
43-
response = urlopen(request)
44+
response = urlopen(request, context=ssl._create_unverified_context())
4445
return response
4546
except HTTPError as err:
4647
error_msg = err.read().decode('utf-8')

0 commit comments

Comments
 (0)