1616_instance_config = (
1717 ((RecaptchaV2Request ,), getRecaptchaV2Timeouts ),
1818 ((RecaptchaV2EnterpriseRequest ,), getRecaptchaV2EnterpriseTimeouts ),
19- ((RecaptchaV3ProxylessRequest ), getRecaptchaV3Timeouts ),
20- ((RecaptchaV3EnterpriseRequest ), getRecaptchaV3Timeouts ),
21- ((ImageToTextRequest ), getImage2TextTimeouts ),
19+ ((RecaptchaV3ProxylessRequest , ), getRecaptchaV3Timeouts ),
20+ ((RecaptchaV3EnterpriseRequest , ), getRecaptchaV3Timeouts ),
21+ ((ImageToTextRequest , ), getImage2TextTimeouts ),
2222 ((FuncaptchaRequest ,), getFuncaptchaTimeouts ),
2323 ((HcaptchaRequest ,), getHcaptchaTimeouts ),
2424 ((GeetestRequest ,), getGeetestTimeouts ),
3131 ((AmazonWafRequest ,), getAmazonWafTimeouts ),
3232 ((BinanceTaskRequest ,), getBinanceTimeouts ),
3333 ((ImpervaCustomTaskRequest ,), getImpervaTimeouts ),
34- ((RecognitionComplexImageTaskRequest ), getCITTimeouts ),
35- ((MTCaptchaRequest ), getImage2TextTimeouts ),
36- ((YidunRequest ), getYidunTimeouts ),
37- ((TemuCustomTaskRequest ), getTemuTimeouts ),
38- ((ProsopoTaskRequest ), getProsopoTimeouts ),
39- ((AltchaCustomTaskRequest ), getAltchaTimeouts ),
34+ ((RecognitionComplexImageTaskRequest ,), getCITTimeouts ),
35+ ((MTCaptchaRequest ,), getImage2TextTimeouts ),
36+ ((YidunRequest ,), getYidunTimeouts ),
37+ ((TemuCustomTaskRequest ,), getTemuTimeouts ),
38+ ((ProsopoTaskRequest ,), getProsopoTimeouts ),
39+ ((AltchaCustomTaskRequest ,), getAltchaTimeouts ),
40+ ((CastleCustomTaskRequest ,), getCastleTimeouts ),
41+ ((TspdCustomTaskRequest ,), getTspdTimeouts ),
42+ ((HuntCustomTaskRequest ,), getHuntTimeouts ),
4043)
4144
4245
@@ -100,7 +103,10 @@ async def solve_captcha(self, request: Union[
100103 YidunRequest ,
101104 TemuCustomTaskRequest ,
102105 ProsopoTaskRequest ,
103- AltchaCustomTaskRequest ],
106+ AltchaCustomTaskRequest ,
107+ CastleCustomTaskRequest ,
108+ TspdCustomTaskRequest ,
109+ HuntCustomTaskRequest ],
104110 ) -> Dict [str , str ]:
105111 '''
106112 Non-blocking method for captcha solving.
@@ -148,6 +154,7 @@ async def _solve(self, request: Union[
148154 raise GetTaskError (f'[{ getTaskResponse .get ("errorCode" )} ] ' \
149155 f'{ getTaskResponse .get ("errorDescription" )} .' )
150156 timer = RequestController (timeout = timeouts .timeout )
157+ timer .run ()
151158 await asyncio .sleep (timeouts .firstRequestDelay )
152159 result = CaptchaResult ()
153160 while not timer .cancel :
@@ -165,13 +172,10 @@ async def _solve(self, request: Union[
165172 elif getResultResponse .get ('status' ) == 'ready' :
166173 timer .stop ()
167174 result .solution = getResultResponse .get ('solution' )
168- break
169-
170- if result != None :
171- return result .solution
172- else :
173- raise TimeoutError ('Failed to get a solution within the maximum ' \
174- f'response waiting interval: { timeouts .timeout :0.1f} sec.' )
175+ return result .solution
176+
177+ raise TimeoutError ('Failed to get a solution within the maximum ' \
178+ f'response waiting interval: { timeouts .timeout :0.1f} sec.' )
175179
176180
177181 async def _getTaskResult (self , task_id : str ) -> Dict [str , Union [int , str , None ]]:
0 commit comments