How to virus scan an HTML file in Python

Cloudmersive
1 min readMay 24, 2020

--

Virus scanning has never been easier, as you will see in today’s API demonstration. Dangerous files will soon be a thing of the past!

To install our client files, just add it with pip install, like so.

pip install cloudmersive-virus-api-client

Now we shall use the scan_file function to check out our file, like this:

from __future__ import print_functionimport timeimport cloudmersive_virus_api_clientfrom cloudmersive_virus_api_client.rest import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_virus_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_virus_api_client.ScanApi(cloudmersive_virus_api_client.ApiClient(configuration))input_file = '/path/to/file' # file | Input file to perform the operation on.try:# Scan a file for virusesapi_response = api_instance.scan_file(input_file)pprint(api_response)except ApiException as e:print("Exception when calling ScanApi->scan_file: %s\n" % e)

And it’s seriously just that easy! If you would like more options for your virus scan, there is an advanced version of this function available as well.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet