WebBrowser/VirusTotal/VirusTotalApi.py

changeset 6121
d3d64f3128b3
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
diff -r 4c60a21ce6dd -r d3d64f3128b3 WebBrowser/VirusTotal/VirusTotalApi.py
--- a/WebBrowser/VirusTotal/VirusTotalApi.py	Wed Feb 07 18:57:46 2018 +0100
+++ b/WebBrowser/VirusTotal/VirusTotalApi.py	Wed Feb 07 20:14:09 2018 +0100
@@ -127,17 +127,20 @@
         nam = WebBrowser.WebBrowserWindow.WebBrowserWindow\
             .networkManager()
         reply = nam.post(request, params)
-        reply.finished.connect(self.__checkServiceKeyValidityFinished)
+        reply.finished.connect(
+            lambda: self.__checkServiceKeyValidityFinished(reply))
         self.__replies.append(reply)
     
-    def __checkServiceKeyValidityFinished(self):
+    def __checkServiceKeyValidityFinished(self, reply):
         """
         Private slot to determine the result of the service key validity check.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         """
         res = False
         msg = ""
         
-        reply = self.sender()
         if reply.error() == QNetworkReply.NoError:
             res = True
         elif reply.error() == self.ServiceCode_InvalidKey:
@@ -169,11 +172,13 @@
         reply.finished.connect(self.__submitUrlFinished)
         self.__replies.append(reply)
     
-    def __submitUrlFinished(self):
+    def __submitUrlFinished(self, reply):
         """
         Private slot to determine the result of the URL scan submission.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         """
-        reply = self.sender()
         if reply.error() == QNetworkReply.NoError:
             result = json.loads(str(reply.readAll(), "utf-8"))
             if result["response_code"] == self.ServiceResult_ItemPresent:
@@ -213,12 +218,14 @@
         reply.finished.connect(self.__getUrlScanReportUrlFinished)
         self.__replies.append(reply)
     
-    def __getUrlScanReportUrlFinished(self):
+    def __getUrlScanReportUrlFinished(self, reply):
         """
-        Private slot to determine the result of the URL scan report URL
+        Private slot to determine the result of the URL scan report URL.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         request.
         """
-        reply = self.sender()
         if reply.error() == QNetworkReply.NoError:
             result = json.loads(str(reply.readAll(), "utf-8"))
             if "filescan_id" in result and result["filescan_id"] is not None:
@@ -246,12 +253,14 @@
         reply.finished.connect(self.__getFileScanReportUrlFinished)
         self.__replies.append(reply)
     
-    def __getFileScanReportUrlFinished(self):
+    def __getFileScanReportUrlFinished(self, reply):
         """
         Private slot to determine the result of the file scan report URL
         request.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         """
-        reply = self.sender()
         if reply.error() == QNetworkReply.NoError:
             result = json.loads(str(reply.readAll(), "utf-8"))
             self.fileScanReport.emit(result["permalink"])
@@ -284,11 +293,13 @@
         reply.finished.connect(self.__getIpAddressReportFinished)
         self.__replies.append(reply)
     
-    def __getIpAddressReportFinished(self):
+    def __getIpAddressReportFinished(self, reply):
         """
         Private slot to process the IP address report data.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         """
-        reply = self.sender()
         if reply.error() == QNetworkReply.NoError:
             result = json.loads(str(reply.readAll(), "utf-8"))
             if result["response_code"] == 0:
@@ -340,14 +351,16 @@
         nam = WebBrowser.WebBrowserWindow.WebBrowserWindow\
             .networkManager()
         reply = nam.get(request)
-        reply.finished.connect(self.__getDomainReportFinished)
+        reply.finished.connect(lambda: self.__getDomainReportFinished(reply))
         self.__replies.append(reply)
     
-    def __getDomainReportFinished(self):
+    def __getDomainReportFinished(self, reply):
         """
         Private slot to process the IP address report data.
+        
+        @param reply reference to the network reply
+        @type QNetworkReply
         """
-        reply = self.sender()
         if reply.error() == QNetworkReply.NoError:
             result = json.loads(str(reply.readAll(), "utf-8"))
             if result["response_code"] == 0:

eric ide

mercurial