def run(self): """ Main entry point to functionality. Returns an array of arrest records. """ self._load_cookies() self._get_captcha(self.captcha_guid) dbc_client = deathbycaptcha.HttpClient(DBC_USERNAME, DBC_PASSWORD) captcha_res = dbc_client.decode('captcha.jpg') captcha_text = captcha_res['text'] logging.info("CAPTCHA text: " + captcha_text) all_recs = [] for date in self.dates: # Parsing intermittently fails with a AttributeErrorException # because 'soup' does not have an HTML table as expected. This while # loop keeps trying until there is not exception. while True: try: search_res = self.search_arrests(captcha_text, date=date) soup = BeautifulSoup(search_res, "html.parser") recs = self._parse_results(soup) all_recs += recs except: continue break return all_recs
def ReportCaptcha(captchaId): '''Сообщаем о неверном решении''' if captchaService == 'DeathByCaptcha'.lower(): client = deathbycaptcha.HttpClient(captchaLogin, captchaPassword) try: client.report(captchaId) except Exception as error: raise Exception('Failed reporting captcha: %s' % error) else: raise Exception('Unknown captcha service')
def SolveCaptcha(imageUrl): '''Решаем капчу, возвращаем текст и id капчи''' if captchaService == 'DeathByCaptcha'.lower(): client = deathbycaptcha.HttpClient(captchaLogin, captchaPassword) try: captcha = client.decode(urllib.urlopen(imageUrl), deathbycaptcha.DEFAULT_TIMEOUT) return str(captcha['text']), captcha['captcha'] except Exception as error: raise Exception('Failed solving captcha: %s' % error) else: raise Exception('Unknown captcha service')
def image_captcha(self,xpath): try: from captcha import DBC_USERNAME, DBC_PASSWORD except: pass image_source = self.single_xpath(xpath) if image_source: image = grab(image_source,http_obj=self.http) image.save('captcha.jpg') result = deathbycaptcha.HttpClient(DBC_USERNAME,DBC_PASSWORD).decode(StringIO.StringIO(str(image))) if result: return result['text']
def solve_captcha(filename): client = deathbycaptcha.HttpClient("LOGIN", "PASSWORD") # client.is_verbose = True DEFAULT_TIMEOUT = 90 print 'Your balance is %s US cents' % client.get_balance() try: # Put your CAPTCHA image file name or file-like object, and optional # solving timeout (in seconds) here: captcha = client.decode(filename + ".png", DEFAULT_TIMEOUT) except Exception, e: sys.stderr.write('Failed uploading CAPTCHA: %s\n' % (e, )) captcha = None
# 162.212.173.198:80:bypass:bypass123 # Put the proxy and reCaptcha token data Captcha_dict = { 'proxy': 'http://*****:*****@127.0.0.1:1234', 'proxytype': 'HTTP', 'sitekey': '56489210-0c02-58c0-00e5-1763b63dc9d4', 'pageurl': 'https://clientdemo.demo.com/demo-page' } # Create a json string json_Captcha = json.dumps(Captcha_dict) # client = deathbycaptcha.SocketClient(username, password, authtoken) # to use http client client = deathbycaptcha.HttpClient(username, password) client = deathbycaptcha.HttpClient(username, password, authtoken) try: balance = client.get_balance() print(balance) # Put your CAPTCHA type and Json payload here: captcha = client.decode(type=7, hcaptcha_params=json_Captcha) if captcha: # The CAPTCHA was solved; captcha["captcha"] item holds its # numeric ID, and captcha["text"] item its list of "coordinates". print("CAPTCHA %s solved: %s" % (captcha["captcha"], captcha["text"])) if '': # check if the CAPTCHA was incorrectly solved client.report(captcha["captcha"]) except deathbycaptcha.AccessDeniedException:
options.password = getpass.getpass('Amazon.com password: '******'Death By Captcha login failed' else: print 'Death By Captcha balance: %.3f cents' % dbc.get_balance() dbc.close() use_deathbycaptcha = True except Exception: pass br = login() if not br: print "Could not log in" sys.exit(1) your_queue_list = get_list(br, your_queue_url, "Your Queue")
def __init__(self, login='******', password='******'): self.solver = dbc.HttpClient(login, password)
password = "******" # Put the proxy and reCaptcha token data Captcha_dict = { 'proxy': 'http://*****:*****@127.0.0.1:1234', 'proxytype': 'HTTP', 'googlekey': '6Lc2fhwTAAAAAGatXTzFYfvlQMI2T7B6ji8UVV_f', 'pageurl': 'http://google.com' } # Create a json string json_Captcha = json.dumps(Captcha_dict) # client = deathbycaptcha.SocketClient(username, password) # to use http client client = deathbycaptcha.HttpClient(username, password) client = deathbycaptcha.HttpClient(username, password) try: balance = client.get_balance() # Put your CAPTCHA type and Json payload here: captcha = client.decode(type=4, token_params=json_Captcha) if captcha: # The CAPTCHA was solved; captcha["captcha"] item holds its # numeric ID, and captcha["text"] item its list of "coordinates". print("CAPTCHA %s solved: %s" % (captcha["captcha"], captcha["text"])) if '': # check if the CAPTCHA was incorrectly solved client.report(captcha["captcha"]) except deathbycaptcha.AccessDeniedException: # Access to DBC API denied, check your credentials and/or balance