Explorar o código

[update] 更新httpbin检验

jhao %!s(int64=7) %!d(string=hai) anos
pai
achega
2260c6d02f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      Util/utilFunction.py

+ 1 - 1
Util/utilFunction.py

@@ -100,7 +100,7 @@ def validUsefulProxy(proxy):
     try:
         # 超过20秒的代理就不要了
         r = requests.get('http://httpbin.org/ip', proxies=proxies, timeout=10, verify=False)
-        if r.status_code == 200 and r.headers['content-type'].lower().find('application/json') != -1 and r.json()['origin']:
+        if r.status_code == 200 and r.json().get("origin"):
             # logger.info('%s is ok' % proxy)
             return True
     except Exception as e: