Selaa lähdekoodia

取消SSL判断

zhangdongming 9 kuukautta sitten
vanhempi
commit
6873a6c8b3
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      Service/VivoPushService/push_admin/APISenderBase.py

+ 3 - 1
Service/VivoPushService/push_admin/APISenderBase.py

@@ -1,4 +1,5 @@
 import logging
+import ssl
 import time
 import json
 import urllib.request, urllib.parse, urllib.error
@@ -53,7 +54,8 @@ def _http_call(url, method, token, **message):
         req.add_header('authToken', token)
     req.add_header('Content-Type', 'application/json;charset=UTF-8')
     try:
-        resp = urllib.request.urlopen(req, timeout=10)
+        context = ssl._create_unverified_context()
+        resp = urllib.request.urlopen(req, context=context, timeout=10)
         r = _parse_json(resp.read().decode())
         return r
     except urllib.error.HTTPError as e: