Browse Source

[update] 更新httpbin检验

jhao 7 năm trước cách đây
mục cha
commit
2260c6d02f
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      Util/utilFunction.py

+ 1 - 1
Util/utilFunction.py

@@ -100,7 +100,7 @@ def validUsefulProxy(proxy):
     try:
     try:
         # 超过20秒的代理就不要了
         # 超过20秒的代理就不要了
         r = requests.get('http://httpbin.org/ip', proxies=proxies, timeout=10, verify=False)
         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)
             # logger.info('%s is ok' % proxy)
             return True
             return True
     except Exception as e:
     except Exception as e: