diff options
author | André Glüpker <git@wgmd.de> | 2016-03-19 13:23:47 +0100 |
---|---|---|
committer | André Glüpker <git@wgmd.de> | 2016-03-19 13:23:47 +0100 |
commit | f17bb3bddb0e5774e78bb4b30a2f136e31f29a20 (patch) | |
tree | 4f007a664953d8a48086031a74c5a931cea0957a /9kwpyqt.py | |
parent | b8eaf250426796ed4420a8cdc84a96f387ffd155 (diff) | |
download | 9kwpyqt-f17bb3bddb0e5774e78bb4b30a2f136e31f29a20.tar.gz 9kwpyqt-f17bb3bddb0e5774e78bb4b30a2f136e31f29a20.tar.bz2 9kwpyqt-f17bb3bddb0e5774e78bb4b30a2f136e31f29a20.zip |
Show number of 'NO CAPTCHA'-Messages
Diffstat (limited to '9kwpyqt.py')
-rwxr-xr-x | 9kwpyqt.py | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -32,6 +32,9 @@ class CaptchaGUI(QWidget): apiurl = API_URL+"?source=pythonapi&apikey="+API_KEY+"&" offlinemessage = "Click \"Start\" to fetch next captcha." + waitingoncaptcha = 0 + + def __init__(self, parent=None): super(CaptchaGUI, self).__init__(parent) self.setMinimumWidth(400) @@ -221,14 +224,19 @@ class CaptchaGUI(QWidget): content = str(self.networkCaptchaIDReply.readAll(), encoding='utf-8') self.networkCaptchaIDReply.deleteLater() if content == 'NO CAPTCHA': - status = self.captchaImage.text()+"." + self.waitingoncaptcha += 1 + status = "Server responded with 'NO CAPTCHA' "+str(self.waitingoncaptcha)+" times." self.captchaImage.setText(status) QTimer.singleShot(1000, self.getCaptchaID) - elif not content.isnumeric(): - self.captchaImage.setText("Unknown error? ID not 'NO CAPTCHA' nor number") - else: + elif content.isnumeric(): + self.waitingoncaptcha = 0 + print("New Captcha:", int(content)) self.currentCaptchaID = int(content) self.getCaptchaIMG() + else: + self.waitingoncaptcha += 1 + print("Unknown error? ID not 'NO CAPTCHA' nor number") + print(content) def getCaptchaIMG(self): url = QUrl(self.apiurl+"action=usercaptchashow&id="+str(self.currentCaptchaID)) |