14 except NameError: |
14 except NameError: |
15 pass |
15 pass |
16 |
16 |
17 import json |
17 import json |
18 |
18 |
19 from PyQt5.QtCore import QObject, QUrl, QByteArray, pyqtSignal, qVersion |
19 from PyQt5.QtCore import QObject, QUrl, QByteArray, pyqtSignal |
20 from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply |
20 from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply |
21 |
21 |
22 from E5Gui import E5MessageBox |
22 from E5Gui import E5MessageBox |
23 |
23 |
24 import Preferences |
24 import Preferences |
|
25 from Globals import qVersionTuple |
25 |
26 |
26 |
27 |
27 class VirusTotalAPI(QObject): |
28 class VirusTotalAPI(QObject): |
28 """ |
29 """ |
29 Class implementing the <a href="http://www.virustotal.com">VirusTotal</a> |
30 Class implementing the <a href="http://www.virustotal.com">VirusTotal</a> |
266 queryItems = [ |
267 queryItems = [ |
267 ("apikey", Preferences.getHelp("VirusTotalServiceKey")), |
268 ("apikey", Preferences.getHelp("VirusTotalServiceKey")), |
268 ("ip", ipAddress), |
269 ("ip", ipAddress), |
269 ] |
270 ] |
270 url = QUrl(self.GetIpAddressReportUrl) |
271 url = QUrl(self.GetIpAddressReportUrl) |
271 if qVersion() >= "5.0.0": |
272 if qVersionTuple() >= (5, 0, 0): |
272 from PyQt5.QtCore import QUrlQuery |
273 from PyQt5.QtCore import QUrlQuery |
273 query = QUrlQuery() |
274 query = QUrlQuery() |
274 query.setQueryItems(queryItems) |
275 query.setQueryItems(queryItems) |
275 url.setQuery(query) |
276 url.setQuery(query) |
276 else: |
277 else: |
328 queryItems = [ |
329 queryItems = [ |
329 ("apikey", Preferences.getHelp("VirusTotalServiceKey")), |
330 ("apikey", Preferences.getHelp("VirusTotalServiceKey")), |
330 ("domain", domain), |
331 ("domain", domain), |
331 ] |
332 ] |
332 url = QUrl(self.GetDomainReportUrl) |
333 url = QUrl(self.GetDomainReportUrl) |
333 if qVersion() >= "5.0.0": |
334 if qVersionTuple() >= (5, 0, 0): |
334 from PyQt5.QtCore import QUrlQuery |
335 from PyQt5.QtCore import QUrlQuery |
335 query = QUrlQuery() |
336 query = QUrlQuery() |
336 query.setQueryItems(queryItems) |
337 query.setQueryItems(queryItems) |
337 url.setQuery(query) |
338 url.setQuery(query) |
338 else: |
339 else: |