Explorar o código

[update] 多次请求失败时,返回百度页面,返回None会有问题

jhao104 %!s(int64=8) %!d(string=hai) anos
pai
achega
5c8fd5760f
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      Util/WebRequest.py

+ 2 - 1
Util/WebRequest.py

@@ -82,5 +82,6 @@ class WebRequest(object):
                 print(e)
                 retry_time -= 1
                 if retry_time <= 0:
-                    return
+                    # 多次请求失败时,返回百度页面
+                    return requests.get("https://www.baidu.com/")
                 time.sleep(retry_interval)