MCPcopy Index your code
hub / github.com/pyload/pyload / captcha_task

Method captcha_task

module/plugins/hooks/DeathByCaptcha.py:159–188  ·  view source on GitHub ↗
(self, task)

Source from the content-addressed store, hash-verified

157 return ticket, result
158
159 def captcha_task(self, task):
160 if "service" in task.data:
161 return False
162
163 if not task.isTextual():
164 return False
165
166 if not self.config.get('username') or not self.config.get('password'):
167 return False
168
169 if self.pyload.isClientConnected() and self.config.get('check_client'):
170 return False
171
172 try:
173 self.get_status()
174 self.get_credits()
175 except DeathByCaptchaException, e:
176 self.log_error(e.message)
177 return False
178
179 balance, rate = self.info['balance'], self.info['rate']
180 self.log_info(_("Account balance"),
181 _("US$%.3f (%d captchas left at %.2f cents each)") % (balance / 100,
182 balance // rate, rate))
183
184 if balance > rate:
185 task.handler.append(self)
186 task.data['service'] = self.classname
187 task.setWaiting(180)
188 self._process_captcha(task)
189
190 def captcha_invalid(self, task):
191 if task.data['service'] == self.classname and "ticket" in task.data:

Callers

nothing calls this directly

Calls 11

get_statusMethod · 0.95
get_creditsMethod · 0.95
_process_captchaMethod · 0.95
isTextualMethod · 0.80
isClientConnectedMethod · 0.80
log_errorMethod · 0.80
log_infoMethod · 0.80
setWaitingMethod · 0.80
_Function · 0.50
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected