Правка примера работы с капчёй-изображением.
Удаление файла с текстом - изображением в формате base64[за ненадобностью]
This commit is contained in:
parent
9e188a8c34
commit
0d5be41b9f
|
@ -17,7 +17,7 @@ This library implements two different methods for saving images (for their subse
|
|||
1. As a temporary file, the parameter is set by default:
|
||||
save_format = 'temp'.
|
||||
2. As a normal file, you need to pass this:
|
||||
save_format = 'const' . !!!USE IT ON WINDOWS!!!
|
||||
save_format = 'const' . !!! USE IT ON WINDOWS !!!
|
||||
"""
|
||||
# Пример который показывает работу антикапчи при решении капчи-изображением и сохранением её в качестве обычного файла в
|
||||
# папку.
|
||||
|
@ -38,17 +38,6 @@ print(result)
|
|||
========================================================================================================================
|
||||
Base64 files
|
||||
|
||||
Пример работы с передачей файла капчи уже закодированного в base64
|
||||
An example of working with captcha file already encoded in base64
|
||||
"""
|
||||
# закодировано: 976979
|
||||
base_64_file = open('base64image.txt', 'rb')
|
||||
|
||||
user_answer_base64 = ImageToTextTask.ImageToTextTask(anticaptcha_key=ANTICAPTCHA_KEY).captcha_handler(captcha_base64=base_64_file)
|
||||
|
||||
print(user_answer_base64)
|
||||
|
||||
"""
|
||||
Пример работы с декодированием в base64 файла-капчи "налету"
|
||||
An example of working with decoding in base64 captcha-file after download. On-the-fly-encoding
|
||||
"""
|
||||
|
@ -83,7 +72,7 @@ try:
|
|||
user_answer_local = ImageToTextTask.ImageToTextTask(anticaptcha_key=ANTICAPTCHA_KEY).captcha_handler(captcha_file=captcha_file)
|
||||
if user_answer_local['errorId'] == 0:
|
||||
# решение капчи
|
||||
print(user_answer_local['captchaSolve'])
|
||||
print(user_answer_local['solution']['text'])
|
||||
print(user_answer_local['taskId'])
|
||||
elif user_answer_local['errorId'] == 1:
|
||||
# Тело ошибки, если есть
|
||||
|
@ -106,22 +95,17 @@ async def run():
|
|||
.captcha_handler(captcha_link='http://85.255.8.26/static/image/common_image_example/800070.png')
|
||||
|
||||
print(resolve)
|
||||
except Exception as err:
|
||||
print(err)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(run())
|
||||
loop.close()
|
||||
|
||||
|
||||
async def run():
|
||||
try:
|
||||
resolve = await ImageToTextTask.aioImageToTextTask(anticaptcha_key=ANTICAPTCHA_KEY)\
|
||||
.captcha_handler(captcha_file=captcha_file)
|
||||
|
||||
print(resolve)
|
||||
|
||||
resolve = await ImageToTextTask.aioImageToTextTask(anticaptcha_key = ANTICAPTCHA_KEY) \
|
||||
.captcha_handler(captcha_base64=base_64_link)
|
||||
|
||||
print(resolve)
|
||||
|
||||
except Exception as err:
|
||||
print(err)
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue