From b5917cc1681925218d72bdb51290dde7f7b274d3 Mon Sep 17 00:00:00 2001 From: Maksim S Date: Fri, 7 Jun 2024 12:08:44 +0200 Subject: [PATCH] RC-2715-fix-async-call-example (#85) * Fix async call example Signed-off-by: Maxim S * Fix async call example Signed-off-by: Maxim S --------- Signed-off-by: Maxim S --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c89ef6a..a595760 100644 --- a/README.md +++ b/README.md @@ -377,13 +377,16 @@ import asyncio import concurrent.futures from twocaptcha import TwoCaptcha -captcha_result = await captchaSolver(image) +API_KEY = "YOUR_API_KEY" +image = "data:image/png;base64,iVBORw0KGgoA..." async def captchaSolver(image): loop = asyncio.get_running_loop() - with concurrent.future.ThreadPoolExecutor() as pool: + with concurrent.futures.ThreadPoolExecutor() as pool: result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image)) return result + +captcha_result = asyncio.run(captchaSolver(image)) ```