瀏覽代碼

add timeout

luojunhui 6 月之前
父節點
當前提交
bca8d4cfd5
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      applications/wxSpiderApi.py

+ 2 - 2
applications/wxSpiderApi.py

@@ -31,7 +31,7 @@ class WeixinSpider(object):
             "keyword": title,
             "cursor": "1"
         })
-        response = requests.request("POST", url, headers=cls.headers, data=payload)
+        response = requests.request("POST", url, headers=cls.headers, data=payload, timeout=120)
         return response.json()
 
     @classmethod
@@ -48,7 +48,7 @@ class WeixinSpider(object):
             "is_count": is_count,
             "is_ad": False
         })
-        response = requests.request("POST", url, headers=cls.headers, data=payload)
+        response = requests.request("POST", url, headers=cls.headers, data=payload, timeout=120)
         return response.json()
 
     @classmethod