소스 검색

add timeout

luojunhui 1 년 전
부모
커밋
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