explicitly close opened url
This commit is contained in:
parent
53e2f00473
commit
4e240b94e1
1 changed files with 2 additions and 1 deletions
3
.github/workflows/ci.py
vendored
3
.github/workflows/ci.py
vendored
|
|
@ -68,7 +68,8 @@ def download_with_retry(url: str | Request, count: int = 5) -> bytes:
|
|||
for i in range(count):
|
||||
try:
|
||||
print('Downloading', url, flush=True)
|
||||
ans: bytes = urlopen(url).read()
|
||||
with urlopen(url) as f:
|
||||
ans: bytes = f.read()
|
||||
return ans
|
||||
except Exception as err:
|
||||
if i >= count - 1:
|
||||
|
|
|
|||
Loading…
Reference in a new issue