提交 f2bf5bf3 编写于 作者: W wizardforcel

优化代码逻辑

上级 c4cb9937
......@@ -32,9 +32,8 @@ def image_download(url):
content = []
last_chunk_time = None
try:
for chunk in request_retry('GET', url,
headers=headers, stream=True
).iter_content(128 * 1024):
r = request_retry('GET', url, headers=headers, stream=True)
for chunk in r.iter_content(128 * 1024):
if last_chunk_time is not None and \
time.time() - last_chunk_time > 5:
return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册