Skip to content

Commit

Permalink
RC-2715-fix-async-call-example (#85)
Browse files Browse the repository at this point in the history
* Fix async call example

Signed-off-by: Maxim S <[email protected]>

* Fix async call example

Signed-off-by: Maxim S <[email protected]>

---------

Signed-off-by: Maxim S <[email protected]>
  • Loading branch information
poplers24 committed Jun 7, 2024
1 parent aaa3e6a commit b5917cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
```


Expand Down

0 comments on commit b5917cc

Please sign in to comment.