# eric5.Helpviewer.VirusTotalApi

Module implementing the VirusTotal API class.

### Global Attributes

None

### Classes

VirusTotalAPI | Class implementing the VirusTotal API.

### Functions

None

## VirusTotalAPI

Class implementing the VirusTotal API.

### Signals

checkServiceKeyFinished(bool, str)
  emitted after the service key check has been performed. It gives a flag indicating validity (boolean) and an error message in case of a network error (string).
fileScanReport(str)
  emitted with the URL of the file scan report page
submitUrlError(str)
  emitted with the error string, if the URL scan submission returned an error.
urlScanReport(str)
  emitted with the URL of the URL scan report page

### Derived from

QObject

### Class Attributes

GetFileReportPattern
GetUrlReportPattern
ReportFileScanPagePattern
ReportUrlScanPagePattern
ScanUrlPattern
SearchUrl
ServiceResult_InvalidServiceKey
ServiceResult_ItemNotPresent
ServiceResult_ItemPresent
ServiceResult_RequestLimitReached
TestServiceKeyScanID

### Class Methods

getSearchRequestData | Class method to assemble the search request data structure.

### Methods

VirusTotalAPI | Constructor
__checkServiceKeyValidityFinished | Private slot to determine the result of the service key validity check.
__getFileScanReportUrl | Private method to get the report URL for a file scan.
__getFileScanReportUrlFinished | Private slot to determine the result of the file scan report URL request.
__loadSettings | Private method to load the settings.
__submitUrlFinished | Private slot to determine the result of the URL scan submission.
checkServiceKeyValidity | Public method to check the validity of the given service key.
preferencesChanged | Public slot to handle a change of preferences.
submitUrl | Public method to submit an URL to be scanned.

### Static Methods

None

#### VirusTotalAPI.getSearchRequestData (class method)

getSearchRequestData(term)

Class method to assemble the search request data structure.

term
  search term (string)

Returns:
  tuple of network request object, operation and parameters (QNetworkRequest, QNetworkAccessManager.Operation, QByteArray)

#### VirusTotalAPI (Constructor)

VirusTotalAPI(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### VirusTotalAPI.__checkServiceKeyValidityFinished

__checkServiceKeyValidityFinished()

Private slot to determine the result of the service key validity check.

#### VirusTotalAPI.__getFileScanReportUrl

__getFileScanReportUrl(scanId)

Private method to get the report URL for a file scan.

scanId
  ID of the scan to get the report URL for (string)

#### VirusTotalAPI.__getFileScanReportUrlFinished

__getFileScanReportUrlFinished()

Private slot to determine the result of the file scan report URL request.

#### VirusTotalAPI.__loadSettings

__loadSettings()

Private method to load the settings.

#### VirusTotalAPI.__submitUrlFinished

__submitUrlFinished()

Private slot to determine the result of the URL scan submission.

#### VirusTotalAPI.checkServiceKeyValidity

checkServiceKeyValidity(key, protocol="")

Public method to check the validity of the given service key.

key
  service key (string)
protocol
  protocol used to access VirusTotal (string)

#### VirusTotalAPI.preferencesChanged

preferencesChanged()

Public slot to handle a change of preferences.

#### VirusTotalAPI.submitUrl

submitUrl(url)

Public method to submit an URL to be scanned.

url
  url to be scanned (QUrl)

Up