VirusTotal module

class VirusTotal.VirusTotal(config: Config)

Bases: Client

Class used for reading responses from VirusTotal API

Initializes the client with API key provided in config file

Parameters:

config – Config object

get_object(*args)

Sends a GET request to a given API endpoint and returns an object.

The endpoint specified must return an object, not a collection. This means that get_object can be used with endpoints like /files/{file_id} and /urls/{url_id}, which return an individual object but not with /comments, which returns a collection of objects.

Parameters:
  • path (str) – Path to API endpoint, can contain format placeholders {}.

  • path_args – A variable number of arguments that are put into any placeholders used in path.

  • params (dict) – Parameters sent in the request.

Returns:

An instance of Object.

static is_security_flagged(response: dict) bool
static read(path: str, key: str, log: Log, config: Config, cache: Cache)

Returns response from API and writes to cache

Parameters:
  • path – path to API endpoint

  • key – key to use when writing to cache

  • log – Log object

  • config – Config object

  • cache – Cache object

Returns:

response from API

Return type:

dict | None