Control¶
To import this module:
from python3_anticaptcha.control import Control
- class python3_anticaptcha.control.Control(api_key: str, *args, **kwargs)¶
- __init__(api_key: str, *args, **kwargs)¶
The class is used to work with Turnstile.
- Parameters:
api_key (str) – Capsolver API key
websiteURL – Address of the webpage
websiteKey – Turnstile sitekey
proxyType – Type of the proxy
proxyAddress – Proxy IP address IPv4/IPv6. Not allowed to use: host names instead of IPs, transparent proxies (where client IP is visible), proxies from local networks (192.., 10.., 127…)
proxyPort – Proxy port.
sleep_time – The waiting time between requests to get the result of the Captcha
kwargs – Additional not required params for main request body. Like callbackUrl/languagePool and etc. More info - https://anti-captcha.com/apidoc/methods/createTask
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_balance() { "errorId": 0, "balance": 14.12396 }
>>> Control.get_queue_status(queue_id=1) { "waiting": 234, "load": 46.58, "bid": 0.000576, "speed": 8.43, "total": 438 }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_spending_stats(softId=867) { "errorId":0, "data":[ { "dateFrom":1679183850, "dateTill":1679187449, "volume":0, "money":0 } ] }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_app_stats(softId=867, mode='views') { "errorId":0, "chartData":[ { ...... } ], "fromDate":"17 Feb 23:48", "toDate":"19 Mar 23:48" }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_incorrect_image(taskId=425436541) { "errorId":0, "status":"success" }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_incorrect_recaptcha(taskId=425436541) { "errorId":0, "status":"success" }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_correct_recaptcha(taskId=425436541) { "errorId":0, "status":"success" }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_incorrect_hcaptcha(taskId=425436541) { "errorId":0, "status":"success" }
Notes
https://anti-captcha.com/apidoc/methods/getBalance
https://anti-captcha.com/apidoc/methods/getQueueStats
https://anti-captcha.com/apidoc/methods/getSpendingStats
https://anti-captcha.com/apidoc/methods/getAppStats
https://anti-captcha.com/apidoc/methods/reportIncorrectHcaptcha
https://anti-captcha.com/apidoc/methods/reportCorrectRecaptcha
https://anti-captcha.com/apidoc/methods/reportIncorrectRecaptcha
https://anti-captcha.com/apidoc/methods/reportIncorrectImageCaptcha
- get_balance() dict ¶
Retrieve an account balance with its account key.
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_balance() { "errorId": 0, "balance": 14.12396 }
- Returns:
Dict with full server response
- Return type:
dict
- async aio_get_balance() dict ¶
Async retrieve an account balance with its account key.
Examples
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_get_balance() { "errorId": 0, "balance": 14.12396 }
- Returns:
Dict with full server response
- Return type:
dict
- static get_queue_status(queue_id: int) dict ¶
This method makes it possible to define a suitable time for uploading a new task
- Parameters:
queue_id (int) – Identifier of a queue
Examples
>>> Control.get_queue_status(queue_id=1) { "waiting": 234, "load": 46.58, "bid": 0.000576, "speed": 8.43, "total": 438 }
>>> Control.get_queue_status(queue_id=20) { "waiting": 90, "load": 38.36, "bid": 0.002, "speed": 7.38, "total": 146 }
- Returns:
Dict with full server response
- Return type:
dict
- async static aio_get_queue_status(queue_id: int) dict ¶
Async method makes it possible to define a suitable time for uploading a new task
- Parameters:
queue_id (int) – Identifier of a queue
Examples
>>> await Control.aio_get_queue_status(queue_id=1) { "waiting": 234, "load": 46.58, "bid": 0.000576, "speed": 8.43, "total": 438 }
>>> await Control.aio_get_queue_status(queue_id=20) { "waiting": 90, "load": 38.36, "bid": 0.002, "speed": 7.38, "total": 146 }
- Returns:
Dict with full server response
- Return type:
dict
- get_spending_stats(**kwargs) dict ¶
This method grabs account spendings and task volume statistics for a 24 hour period.
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_spending_stats(softId=867) { "errorId":0, "data":[ { "dateFrom":1679183850, "dateTill":1679187449, "volume":0, "money":0 } ] }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_spending_stats(softId=867, ... queue="English ImageToText") { "errorId":0, "data":[ { "dateFrom":1679183850, "dateTill":1679187449, "volume":0, "money":0 } ] }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_spending_stats(queue="English ImageToText") { "errorId":0, "data":[ { "dateFrom":1679183850, "dateTill":1679187449, "volume":0, "money":0 } ] }
- Returns:
Dict with full server response
- Return type:
dict
- async aio_get_spending_stats(**kwargs) dict ¶
Async method grabs account spendings and task volume statistics for a 24 hour period.
Examples
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_get_spending_stats(softId=867) { "errorId":0, "data":[ { "dateFrom":1679183850, "dateTill":1679187449, "volume":0, "money":0 } ] }
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_get_spending_stats(softId=867, ... queue="English ImageToText") { "errorId":0, "data":[ { "dateFrom":1679183850, "dateTill":1679187449, "volume":0, "money":0 } ] }
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_get_spending_stats(queue="English ImageToText") { "errorId":0, "data":[ { "dateFrom":1679183850, "dateTill":1679187449, "volume":0, "money":0 } ] }
- Returns:
Dict with full server response
- Return type:
dict
- get_app_stats(softId: int, mode: str | None = None) dict ¶
- This method retrieves daily statistics for your application, which you register in Developer Center.
Statistics are available only to the application owner. Improper access returns ERROR_ACCESS_DENIED.
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_app_stats(softId=867, mode='views') { "errorId":0, "chartData":[ { ...... } ], "fromDate":"17 Feb 23:48", "toDate":"19 Mar 23:48" }
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").get_app_stats(softId=867, mode='errors') { "errorId":0, "chartData":[ { ...... } ], "fromDate":"17 Feb 23:48", "toDate":"19 Mar 23:48" }
- Returns:
Dict with full server response
- Return type:
dict
- async aio_get_app_stats(softId: int, mode: str | None = None) dict ¶
- Async method retrieves daily statistics for your application, which you register in Developer Center.
Statistics are available only to the application owner. Improper access returns ERROR_ACCESS_DENIED.
Examples
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_get_app_stats(softId=867, mode='views') { "errorId":0, "chartData":[ { ...... } ], "fromDate":"17 Feb 23:48", "toDate":"19 Mar 23:48" }
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_get_app_stats(softId=867, mode='errors') { "errorId":0, "chartData":[ { ...... } ], "fromDate":"17 Feb 23:48", "toDate":"19 Mar 23:48" }
- Returns:
Dict with full server response
- Return type:
dict
- report_incorrect_image(taskId: int) dict ¶
Complaints are accepted for image captchas only.
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_incorrect_image(taskId=425436541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict
- async aio_report_incorrect_image(taskId: int) dict ¶
Async complaints are accepted for image captchas only.
Examples
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_report_incorrect_image(taskId=425436541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict
- report_incorrect_recaptcha(taskId: int) dict ¶
Complaints are accepted for V2 and V3 Recaptchas only, including Enterprise Recaptcha.
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_incorrect_recaptcha(taskId=425436541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict
- async aio_report_incorrect_recaptcha(taskId: int) dict ¶
Async complaints are accepted for V2 and V3 Recaptchas only, including Enterprise Recaptcha.
Examples
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_report_incorrect_recaptcha(taskId=425436541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict
- report_correct_recaptcha(taskId: int) dict ¶
Reporting correctly solved ReCaptcha
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_correct_recaptcha(taskId=425436541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict
- async aio_report_correct_recaptcha(taskId: int) dict ¶
Async reporting correctly solved ReCaptcha
Examples
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_report_correct_recaptcha(taskId=425436541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict
- report_incorrect_hcaptcha(taskId: int) dict ¶
Use this method to send us information about tokens which did not pass on target service
Examples
>>> Control(api_key="99d7d111a0111dc11184111c8bb111da").report_incorrect_hcaptcha(taskId=425436541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict
- async aio_report_incorrect_hcaptcha(taskId: int) dict ¶
Async method to send us information about tokens which did not pass on target service
Examples
>>> await Control(api_key="99d7d111a0111dc11184111c8bb111da").aio_report_incorrect_hcaptcha(taskId=4256541) { "errorId":0, "status":"success" }
- Returns:
Dict with full server response
- Return type:
dict