I have been meaning to ask this, does the function intend to close the file after the scanning?
async def virus_analysis_hash(md5_hash):
with suppress(Exception):
result = await client.get_object_async(f"/files/{md5_hash}")
return result.last_analysis_stats
return None
async def virus_analysis_file(file):
tmp_file = file.file
result = await client.scan_file_async(tmp_file, True)
return result.stats
async def virus_analysis(md5_hash, file):
if not (result := await virus_analysis_hash(md5_hash)):
result = await virus_analysis_file(file)
return (
True if result["malicious"] > 0 or result["suspicious"] > 0 else False
)
I wanted to upload the file after checking if it isn't suspicious or malicious, is there a workaround or how do I stop the function from closing the file?
I have been meaning to ask this, does the function intend to close the file after the scanning?
I wanted to upload the file after checking if it isn't suspicious or malicious, is there a workaround or how do I stop the function from closing the file?