Scanning a Google Cloud Platform (GCP) Storage File for Viruses in Python

Looking to scan your GCP file for viruses and other threats? We’re here to help with that. Our cloud storage virus scan API peruses a continuously updated database of over 17 million virus and malware signatures. All you need to utilize the API is the applicable bucket name, object/file name, and JSON credential file from Google Cloud, as well as the information below.

For our first step, run this command to install the SDK:

pip install cloudmersive-virus-api-client

Next, we are instancing our API using a key and calling the ScanCloudStorage function from the instance using the following code:

from __future__ import print_function
import time
import cloudmersive_virus_api_client
from cloudmersive_virus_api_client.rest import ApiException
from pprint import pprint

And boom! The scan will return an immediate response informing you of the virus name (if found) or assuring you that your file is indeed free from threats.

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