(self, params={}, timeout=120)
| 126 | return result |
| 127 | |
| 128 | def decrypt_interactive(self, params={}, timeout=120): |
| 129 | captchaManager = self.pyload.captchaManager |
| 130 | timeout = max(timeout, 50) |
| 131 | |
| 132 | try: |
| 133 | params.update({'captcha_plugin': self.__name__, |
| 134 | 'plugin': self.pyfile.plugin.__name__}) |
| 135 | self.task = captchaManager.newTask("interactive", params, "interactive") |
| 136 | |
| 137 | captchaManager.handleCaptcha(self.task, timeout) |
| 138 | |
| 139 | while self.task.isWaiting(): |
| 140 | self.pyfile.plugin.check_status() |
| 141 | time.sleep(1) |
| 142 | |
| 143 | finally: |
| 144 | captchaManager.removeTask(self.task) |
| 145 | |
| 146 | result = self.task.result |
| 147 | |
| 148 | if self.task.error: |
| 149 | if not self.task.handler and not self.pyload.isClientConnected(): |
| 150 | self.log_warning(_("No Client connected for captcha decrypting")) |
| 151 | self.fail(_("No Client connected for captcha decrypting")) |
| 152 | else: |
| 153 | self.pyfile.plugin.retry_captcha(msg=self.task.error) |
| 154 | |
| 155 | elif self.task.result: |
| 156 | self.log_info(_("Captcha result: `%s`") % (result,)) |
| 157 | |
| 158 | else: |
| 159 | self.pyfile.plugin.retry_captcha(msg=_("No captcha result obtained in appropriate timing (%ss)") % timeout) |
| 160 | |
| 161 | return result |
| 162 | |
| 163 | def invalid(self, msg=""): |
| 164 | if not self.task: |
no test coverage detected