Helpviewer/VirusTotalApi.py

changeset 2954
bf0215fe12d1
parent 2403
e3d7a861547c
child 2999
28c75409a78f
equal deleted inserted replaced
2953:703452a2876f 2954:bf0215fe12d1
89 """ 89 """
90 Public method to check the validity of the given service key. 90 Public method to check the validity of the given service key.
91 91
92 @param key service key (string) 92 @param key service key (string)
93 @param protocol protocol used to access VirusTotal (string) 93 @param protocol protocol used to access VirusTotal (string)
94 @return flag indicating validity (boolean) and an error message in
95 case of a network error (string)
96 """ 94 """
97 if protocol == "": 95 if protocol == "":
98 urlStr = self.GetFileReportUrl 96 urlStr = self.GetFileReportUrl
99 else: 97 else:
100 urlStr = self.GetFileReportPattern.format(protocol) 98 urlStr = self.GetFileReportPattern.format(protocol)
131 def submitUrl(self, url): 129 def submitUrl(self, url):
132 """ 130 """
133 Public method to submit an URL to be scanned. 131 Public method to submit an URL to be scanned.
134 132
135 @param url url to be scanned (QUrl) 133 @param url url to be scanned (QUrl)
136 @return flag indicating success (boolean) and the scan ID (string)
137 """ 134 """
138 request = QNetworkRequest(QUrl(self.ScanUrlUrl)) 135 request = QNetworkRequest(QUrl(self.ScanUrlUrl))
139 request.setHeader(QNetworkRequest.ContentTypeHeader, 136 request.setHeader(QNetworkRequest.ContentTypeHeader,
140 "application/x-www-form-urlencoded") 137 "application/x-www-form-urlencoded")
141 params = QByteArray( 138 params = QByteArray(
168 def __getFileScanReportUrl(self, scanId): 165 def __getFileScanReportUrl(self, scanId):
169 """ 166 """
170 Private method to get the report URL for a file scan. 167 Private method to get the report URL for a file scan.
171 168
172 @param scanId ID of the scan to get the report URL for (string) 169 @param scanId ID of the scan to get the report URL for (string)
173 @return file scan report URL (string)
174 """ 170 """
175 request = QNetworkRequest(QUrl(self.GetUrlReportUrl)) 171 request = QNetworkRequest(QUrl(self.GetUrlReportUrl))
176 request.setHeader(QNetworkRequest.ContentTypeHeader, 172 request.setHeader(QNetworkRequest.ContentTypeHeader,
177 "application/x-www-form-urlencoded") 173 "application/x-www-form-urlencoded")
178 params = QByteArray("key={0}&resource={1}".format( 174 params = QByteArray("key={0}&resource={1}".format(

eric ide

mercurial