fix
This commit is contained in:
1 parent
d7fcf19bf6
commit
2bde1350de
1 file changed
+3
-3
+3
-3
@@ -25,10 +25,10 @@ class htmlUtils:
|
|||||||
count = 1
|
count = 1
|
||||||
#数据为空则获取数据
|
#数据为空则获取数据
|
||||||
while url_text == None:
|
while url_text == None:
|
||||||
if count < 5 and url_text == None:
|
if count <= 10:
|
||||||
try:
|
try:
|
||||||
print("请求地址:",curl)
|
print("请求地址:",curl)
|
||||||
res = s.get(curl,stream=True, headers=cls.headers, timeout=20)
|
res = s.get(curl,stream=True, headers=cls.headers, timeout=50)
|
||||||
if type == "bytes":
|
if type == "bytes":
|
||||||
url_text = res
|
url_text = res
|
||||||
else:
|
else:
|
||||||
@@ -55,7 +55,7 @@ class htmlUtils:
|
|||||||
def getJSON(cls,curl):
|
def getJSON(cls,curl):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
res = requests.get(curl, headers=cls.headers,timeout=30)
|
res = requests.get(curl, headers=cls.headers,timeout=50)
|
||||||
data_json = res.json()
|
data_json = res.json()
|
||||||
return data_json
|
return data_json
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in new issue
Block a user