How to Scan an Azure Blob for Viruses in Python

Cyberspace can be a dangerous place, and if you’re utilizing an Azure Blob for storage, you want to make sure the contents are virus-free; once a virus infiltrates cloud storage, it may unexpectedly flow into various business critical applications or be downloaded by business users. The following API provides multi-threat scanning in Python for a single Azure Blob and its contents, so you can rest assured that your storage is safe. The high speed in-memory scanning delivers a subsecond response time for a variety of file formats (Office, PDF, HTML, and Flash) and Zip support (.Zip, .Rar, .DMG, .Tar, and other archive formats).

Image for post
Image for post

To use this Cloudmersive API, run this command to install the SDK:

pip install cloudmersive-virus-api-client

Next, you can call the function using the following code:

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

This will return a lightning-fast result indicating if your Azure blob is free from viruses, malware, trojans, ransomware, and spyware. If a threat is found, the API will indicate which virus it is, enabling you to address it immediately. You can retrieve the free API Key from our Cloudmersive website, which will also give you access to 800 monthly calls from our variety of APIs.

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