Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disabling virus scan on google chrome inside python script for downloads

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

like image 787
python_enthusiast Avatar asked Mar 08 '23 01:03

python_enthusiast


1 Answers

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.

like image 62
python_enthusiast Avatar answered Mar 11 '23 09:03

python_enthusiast