[Python] python script to check if the downloaded file from URL is corrupted or not

Discussão em 'Python' iniciado por Stack, Março 24, 2025.

  1. Stack

    Stack Membro Participativo

    I have a request to download files from URL and store in local system. Files are of different format like pdf, ppt, doc, docx, zip, jpg, iso etc. After downloading the files, is there a way to check if downloaded files are corrupted or not. Most of options suggested to use Checksum approach, but I do not have checksum details of file from URL to compare with downloaded file.

    Used below piece of code to download file

    response = requests.get(url_to_download_file,timeout=5)
    with open(local_save_path, 'wb') as file:
    file.write(response.content)

    Continue reading...

Compartilhe esta Página