当前位置: 首页>>代码示例>>Python>>正文


Python Solver.get_result方法代码示例

本文整理汇总了Python中Solver.Solver.get_result方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.get_result方法的具体用法?Python Solver.get_result怎么用?Python Solver.get_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Solver.Solver的用法示例。


在下文中一共展示了Solver.get_result方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import get_result [as 别名]
 def run(self):
     while True:
         html = self.opener.open(captcha_url).read().decode()
         captcha_img_url = host + pq(html)("#captcha_image").attr("src")
         captcha_img = self.opener.open(captcha_img_url).read()
         try:
             solver = Solver(Image.open(BytesIO(captcha_img)), captcha_length)
             result = solver.get_result()
             if len(solver.char_areas) != captcha_length:
                 raise IndexError()
         except IndexError:
             self.queue.put(
                 (Image.open(BytesIO(captcha_img)), Image.open(BytesIO(captcha_img)), "------", False, True))
             continue
         payload = {
             "do": "contact",
             "ct_name": "",
             "ct_email": "",
             "ct_URL": "",
             "ct_message": "",
             "ct_captcha": result
         }
         resp = self.opener.open(captcha_url, urlencode(payload).encode()).read().decode()
         print("put!")
         img_data = {
             'pixels': solver.captcha.tobytes(),
             'size': solver.captcha.size,
             'mode': solver.captcha.mode,
         }
         if "captcha was correct" in resp:
             self.queue.put((Image.open(BytesIO(captcha_img)), img_data, result, True, False))
             print('Corr')
         else:
             self.queue.put((Image.open(BytesIO(captcha_img)), img_data, result, False, False))
             print('Wong')
开发者ID:Saren-Arterius,项目名称:securimage-solver,代码行数:37,代码来源:Test.py

示例2: run

# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import get_result [as 别名]
 def run(self):
     while True:
         buffer = BytesIO(urlopen(captcha_url).read())
         solver = Solver(Image.open(buffer), captcha_length)
         while len(solver.char_areas) != captcha_length:
             buffer = BytesIO(urlopen(captcha_url).read())
             solver = Solver(Image.open(buffer), captcha_length)
         buffer.seek(0)
         captcha_result = solver.get_result()
         CaptchaGatherThread.captchas.put({"captcha": Image.open(buffer), "solver": solver, "guess": captcha_result})
开发者ID:AllenThePythonic,项目名称:securimage-solver,代码行数:12,代码来源:Main.py

示例3: run

# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import get_result [as 别名]
 def run(self):
     while True:
         solver = None
         while solver is None or len(solver.char_areas) != captcha_length:
             rep = urlopen(captcha_url)
             answer = rep.info()['x-captcha-code']
             print(answer)
             buffer = BytesIO(rep.read())
             solver = Solver(Image.open(buffer), captcha_length)
         buffer.seek(0)
         captcha_result = solver.get_result()
         CaptchaGatherThread.captchas.put({"captcha": Image.open(buffer), "solver": solver, "guess": captcha_result, "answer": answer})
         print('Put')
开发者ID:Saren-Arterius,项目名称:securimage-solver,代码行数:15,代码来源:Main.py

示例4: run

# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import get_result [as 别名]
 def run(self):
     while True:
         buffer = BytesIO(self.opener.open(captcha_url).read())
         try:
             solver = Solver(Image.open(buffer), captcha_length)
         except Exception as e:
             print("Rate limit exceeded: ", e)
             return
         while len(solver.char_areas) != captcha_length:
             buffer = BytesIO(self.opener.open(captcha_url).read())
             solver = Solver(Image.open(buffer), captcha_length)
         buffer.seek(0)
         captcha_result = solver.get_result()
         CaptchaGatherThread.captchas.put({"captcha": Image.open(buffer), "solver": solver, "guess": captcha_result})
开发者ID:Saren-Arterius,项目名称:hkgolden-captcha-solver,代码行数:16,代码来源:Main.py


注:本文中的Solver.Solver.get_result方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。