File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -232,9 +232,28 @@ Except TimeoutException as e:
232232 print (e)
233233```
234234
235+ ### Async calls
236+ You can also make async calls with [ asyncio] , for example:
237+
238+ ```
239+ import asyncio
240+ import concurrent.futures
241+ from twocaptcha import TwoCaptcha
242+
243+ captcha_result = await captchaSolver(image)
244+
245+ async def captchaSolver(image):
246+ loop = asyncio.get_running_loop()
247+ with concurrent.futures.ThreadPoolExecutor() as pool:
248+ result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))
249+ return result
250+ ```
251+
252+
235253[ 2Captcha ] : https://2captcha.com/
236254[ 2captcha sofware catalog ] : https://2captcha.com/software
237255[ pingback settings ] : https://2captcha.com/setting/pingback
238256[ post options ] : https://2captcha.com/2captcha-api#normal_post
239257[ list of supported languages ] : https://2captcha.com/2captcha-api#language
240258[ examples directory ] : /examples
259+ [ asyncio ] : https://docs.python.org/3/library/asyncio.html
You can’t perform that action at this time.
0 commit comments