def on_captcha(self, image): logging.info('Solving captcha...') f = StringIO() f.write(image) f.seek(0) dbccli = DBCClient(options.dbc_username, options.dbc_password) try: captcha = dbccli.decode(f, 60) except: log.exception('Error solving captcha') sys.exit(1) if captcha: self.captcha = captcha return captcha['text'], captcha sys.exit(1)
class MyDecapcha: def __init__(self): self.user = '******' self.passwd = 'AAbb1122' self.client = SocketClient(self.user, self.passwd) self.client.is_verbose = False def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): try: self.client.close() except Exception: log.exception('Failed to close dbc client') def decode(self, fn, timeout=60): try: captcha = self.client.decode(fn, timeout=timeout) return captcha['text'].strip() except Exception: log.exception('Failed to decode') return None
def on_captcha_wrong(self, tag): log.info('Captcha wrong!') from deathbycaptcha import SocketClient as DBCClient dbccli = DBCClient(State.options.dbc_username, State.options.dbc_password) dbccli.report(tag['captcha'])
def on_captcha_wrong(self, tag): log.info('Captcha wrong!') dbccli = DBCClient(options.dbc_username, options.dbc_password) dbccli.report(tag['captcha'])
def __init__(self): self.user = '******' self.passwd = 'AAbb1122' self.client = SocketClient(self.user, self.passwd) self.client.is_verbose = False