FriendlyCaptcha

To import this module:

from python3_anticaptcha.friendly_captcha import FriendlyCaptcha
class python3_anticaptcha.friendly_captcha.FriendlyCaptcha(api_key: str, websiteURL: str, websiteKey: str, captcha_type: CaptchaTypeEnm | str = CaptchaTypeEnm.FriendlyCaptchaTaskProxyless, proxyType: ProxyTypeEnm | str | None = None, proxyAddress: str | None = None, proxyPort: int | None = None, proxyLogin: str | None = None, proxyPassword: str | None = None, userAgent: str | None = None, sleep_time: int | None = 10)
__init__(api_key: str, websiteURL: str, websiteKey: str, captcha_type: CaptchaTypeEnm | str = CaptchaTypeEnm.FriendlyCaptchaTaskProxyless, proxyType: ProxyTypeEnm | str | None = None, proxyAddress: str | None = None, proxyPort: int | None = None, proxyLogin: str | None = None, proxyPassword: str | None = None, userAgent: str | None = None, sleep_time: int | None = 10)

The class is used to work with FriendlyCaptcha.

Parameters:
  • api_key (str) – Capsolver API key

  • captcha_type (CaptchaTypeEnm | str) – Captcha type

  • websiteURL (str) – Address of the webpage

  • websiteKey (str) – Friendly Captcha sitekey

  • proxyType (ProxyTypeEnm | str | None) – Type of the proxy

  • proxyAddress (str | None) – 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 (int | None) – Proxy port.

  • proxyLogin (str | None) – Proxy login.

  • proxyPassword (str | None) – Proxy password.

  • userAgent (str | None) – Browser UserAgent.

  • sleep_time (int | None) – The waiting time between requests to get the result of the Captcha

Examples

>>> FriendlyCaptcha(api_key="99d7d111a0111dc11184111c8bb111da",
...         captcha_type="FriendlyCaptchaTaskProxyless",
...         websiteURL="https://demo.arkoselabs.com",
...         websiteKey="FCMDESUD3M34857N"
...        ).captcha_handler()
{
   "errorId": 0,
   "errorCode": None,
   "errorDescription": None,
   "status":"ready",
   "solution":{
      "token":"0.Qz0.....f1",
      "userAgent":"Mozilla/5.0 (Wind.....",
   },
   "cost": 0.002,
   "ip": "46.53.249.230",
   "createTime": 1679004358,
   "endTime": 1679004368,
   "solveCount": 0,
   "taskId": 396687629
}
>>> await FriendlyCaptcha(api_key="99d7d111a0111dc11184111c8bb111da",
...         captcha_type="FriendlyCaptchaTaskProxyless",
...         websiteURL="https://demo.arkoselabs.com",
...         websitePublicKey="DF9C4D87-CB7B-4062-9FEB-BADB6ADA61E6"
...        ).aio_captcha_handler()
{
   "errorId": 0,
   "errorCode": None,
   "errorDescription": None,
   "status":"ready",
   "solution":{
      "token":"0.Qz0.....f1",
      "userAgent":"Mozilla/5.0 (Wind.....",
   },
   "cost": 0.002,
   "ip": "46.53.249.230",
   "createTime": 1679004358,
   "endTime": 1679004368,
   "solveCount": 0,
   "taskId": 396687629
}
>>> FriendlyCaptcha(api_key="99d7d111a0111dc11184111c8bb111da",
...         captcha_type="FriendlyCaptchaTask",
...         websiteURL="https://demo.arkoselabs.com",
...         websitePublicKey="DF9C4D87-CB7B-4062-9FEB-BADB6ADA61E6",
...         proxyType="http",
...         proxyAddress="0.0.0.0",
...         proxyPort=9988,
...         proxyLogin="proxy_login",
...         proxyPassword="proxy_password",
...         userAgent="some_real_user_agent",
...        ).captcha_handler()
{
   "errorId": 0,
   "errorCode": None,
   "errorDescription": None,
   "status":"ready",
   "solution":{
      "token":"0.Qz0.....f1",
      "userAgent":"Mozilla/5.0 (Wind.....",
   },
   "cost": 0.002,
   "ip": "46.53.249.230",
   "createTime": 1679004358,
   "endTime": 1679004368,
   "solveCount": 0,
   "taskId": 396687629
}
Notes

https://anti-captcha.com/apidoc/task-types/FriendlyCaptchaTask

https://anti-captcha.com/apidoc/task-types/FriendlyCaptchaTaskProxyless