Skip to content

Commit d6539d6

Browse files
author
woytu
committed
优化冗余
1 parent cae28db commit d6539d6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

utils/HttpUtil.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ def download_file(url, mkdir, name=""):
190190
# 判断文件是否存在
191191
# if not os.path.exists(name):
192192
if not os.path.isfile(name):
193-
reqs = requests.get(url, headers={"User-Agent": USER_AGENT}, verify=False, timeout=600)
194-
with reqs as req:
193+
with requests.get(url, headers={"User-Agent": USER_AGENT}, verify=False, timeout=600) as req:
195194
with open(name, "wb") as f:
196195
f.write(req.content)
197196
return name

0 commit comments

Comments
 (0)