disabling virus scan on google chrome inside python script for downloads

2.5k views Asked by At

I am downloading some excel files from a website via python script, via Google Chrome. For some reason, some of the downloaded files fail the virus scan and get deleted immediately without any prompt. I know these are safe files because if I manually download them, they always pass the virus scan.

Is there any way to disable the virus scan on Google Chrome from within the python script as the script starts and enable virus scan again upon finish?

Following is my preference setting for Chromedriver:

options.add_experimental_option("prefs", 
    {  "download.default_directory": r'{}\captive_IL'.format(temppath),  
       "download.prompt_for_download": False,  
       "download.directory_upgrade": True,  
       "safebrowsing.enabled": False})

Here is the link which lists all of the preference options available for selenium chromedriver, I couldn't find a virus scan upon download option in this list.

https://cs.chromium.org/chromium/src/chrome/common/pref_names.cc

1

There are 1 answers

0
python_enthusiast On
safebrowsing.disable_download_protection

The above flag when set to True, disables the automatic file deletion that occurs upon a failed virus scan. Although on the GoogleChrome browser window you still see the virus scan failing for the download file. Nonetheless, the file stays in the downloads folder and then we can use it however we want.