From 26efee84e9143600171fca540bf81e6fba198100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Tue, 16 Aug 2016 09:33:39 +0200 Subject: Fix bug with invalid server answers. (hopefully not introducing a new bug) --- 9kwpyqt.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/9kwpyqt.py b/9kwpyqt.py index 047db9c..b29a185 100755 --- a/9kwpyqt.py +++ b/9kwpyqt.py @@ -300,19 +300,14 @@ class CaptchaGUI(QWidget): def setCaptchaAnswerCommit(self): message = str(self.networkCaptchaAnswerReply.readAll(), encoding='utf-8') self.networkCaptchaAnswerReply.deleteLater() - if not message: - # TODO: Server error? Retry! (Status 200 + no 'OK'?) - self.networkCaptchaAnswerReply = self.NetworkManager.get(self.networkCaptchaAnswer) - self.networkCaptchaAnswerReply.finished.connect(self.setCaptchaAnswerCommit) - else: - self.currentCommited += 1 - self.currentCaptchaID = None + if message: if message.startswith('OK') and '|' in message: parts = message.split('|') - creds = int(parts[1]) - self.currentCredits += creds - self.updateStats() - self.getCaptchaID() + if parts[1].isnumeric(): + self.currentCredits += int(parts[1]) + self.currentCommited += 1 + self.updateStats() + self.getCaptchaID() def setCaptchaAnswerSkipped(self): message = str(self.networkCaptchaAnswerReply.readAll(), encoding='utf-8') -- cgit v1.2.3