File closing before return

This commit is contained in:
Eriks K 2020-12-01 15:07:17 +02:00
parent 500409f74a
commit 01e5e44350

View File

@ -152,7 +152,8 @@ def get_file(filepath: str) -> str:
def write_file(filename: str, content: str) -> int:
filename = get_file(filename)
with open(filename, 'ab') as f:
return f.write(content.encode("utf-8"))
ret = f.write(content.encode("utf-8"))
return ret
def write_request(response: requests.Response, is_error: bool = False):