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.

Image for post
Image for post

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 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.

Written by

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store