Fun Captcha

To import this module:

from python3_capsolver.fun_captcha import FunCaptcha
from python3_capsolver.fun_captcha import FunCaptchaClassification
class python3_capsolver.fun_captcha.FunCaptcha(captcha_type: FunCaptchaTypeEnm | str, websiteURL: str, websitePublicKey: str, *args, **kwargs)

The class is used to work with Capsolver FuncaptchaTask methods.

Parameters:
  • api_key – Capsolver API key

  • captcha_type (FunCaptchaTypeEnm | str) – Captcha type name, like FunCaptchaTaskProxyLess and etc.

  • websiteURL (str) – Address of a webpage with Geetest.

  • websitePublicKey (str) – Funcaptcha website key.

Examples

>>> with FunCaptcha(api_key="CAI-1324...",
...             captcha_type="FunCaptchaTaskProxyLess",
...             websiteURL="https://api.funcaptcha.com/fc/api/nojs/",
...             websitePublicKey="69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
...             funcaptchaApiJSSubdomain="https://api.funcaptcha.com/"
...         ) as instance:
>>>     instance.captcha_handler()
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={'token': '44795sds...'}
                  )
>>> with FunCaptcha(api_key="CAI-1324...",
...             captcha_type="FunCaptchaTaskProxyLess",
...             websiteURL="https://api.funcaptcha.com/fc/api/nojs/",
...             websitePublicKey="69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
...             funcaptchaApiJSSubdomain="https://api.funcaptcha.com/"
...         ) as instance:
>>>     await instance.aio_captcha_handler()
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={'token': '44795sds...'}
                  )
Returns:

CaptchaResponseSer model with full server response

captcha_handler() CaptchaResponseSer

Sync solving method

Examples

>>> FunCaptcha(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
...         captcha_type="FunCaptchaTaskProxyLess",
...         websiteURL="https://api.funcaptcha.com/fc/api/nojs/",
...         websitePublicKey="69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
...         funcaptchaApiJSSubdomain="https://api.funcaptcha.com/"
...        ).captcha_handler()
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={'token': '44795sds...'}
                  )
>>> FunCaptcha(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
...         captcha_type="FuncaptchaTask",
...         websiteURL="https://api.funcaptcha.com/fc/api/nojs/",
...         websitePublicKey="69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
...         funcaptchaApiJSSubdomain="https://api.funcaptcha.com/",
...         proxyType="http",
...         proxyAddress="0.0.0.0",
...         proxyPort=9090,
...        ).captcha_handler()
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={'token': '44795sds...'}
                  )
Returns:

CaptchaResponseSer model with full service response

Return type:

CaptchaResponseSer

Notes

Check class docstring for more info

async aio_captcha_handler() CaptchaResponseSer

Async method for captcha solving

Examples

>>> await FunCaptcha(api_key="CAI-1324...",
...         captcha_type="FunCaptchaTaskProxyLess",
...         websiteURL="https://api.funcaptcha.com/fc/api/nojs/",
...         websitePublicKey="69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
...         funcaptchaApiJSSubdomain="https://api.funcaptcha.com/"
...        ).aio_captcha_handler()
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={'token': '44795sds...'}
                  )
>>> await FunCaptcha(api_key="CAI-1324...",
...         captcha_type="FuncaptchaTask",
...         websiteURL="https://api.funcaptcha.com/fc/api/nojs/",
...         websitePublicKey="69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC",
...         funcaptchaApiJSSubdomain="https://api.funcaptcha.com/",
...         proxyType="http",
...         proxyAddress="0.0.0.0",
...         proxyPort=9090,
...        ).aio_captcha_handler()
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={'token': '44795sds...'}
                  )
>>> with open('some_image.jpeg', 'rb') as img_file:
...    img_data = img_file.read()
>>> body = base64.b64encode(img_data).decode("utf-8")
>>> await FunCaptcha(api_key="CAI-1324...",
...         captcha_type="FunCaptchaClassification"
...        ).aio_captcha_handler(
...                     image=body,
...                     question="Ask your question")
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={'token': '44795sds...'}
                  )
Returns:

CaptchaResponseSer model with full service response

Return type:

CaptchaResponseSer

Notes

Check class docstring for more info

class python3_capsolver.fun_captcha.FunCaptchaClassification(images: List[str], question: str, captcha_type: FunCaptchaClassificationTypeEnm | str = FunCaptchaClassificationTypeEnm.FunCaptchaClassification, *args, **kwargs)

The class is used to work with Capsolver FunCaptchaClassification methods.

Parameters:
  • api_key – Capsolver API key

  • captcha_type (FunCaptchaClassificationTypeEnm | str) – Captcha type name, like FunCaptchaClassification and etc.

  • images (List[str]) – Base64 encoded image, can be a screenshot (pass only the hexagonal image, do not pass the rest of the content)

  • question (str) – Question name. this param value from API response game_variant field. Exmaple: maze,maze2,flockCompass,3d_rollball_animals

Examples

>>> FunCaptchaClassification(api_key="CAI-1324...",
...             captcha_type="FunCaptchaClassification",
...             images=["image payload"],
...             question="maze2",
...         ).captcha_handler()
CaptchaResponseSer(errorId=0,
                   errorCode=None,
                   errorDescription=None,
                   taskId='73bdcd28-6c77-4414-8....',
                   status=<ResponseStatusEnm.Ready: 'ready'>,
                   solution={"objects": [ 4 ]}
                  )
Returns:

CaptchaResponseSer model with full server response

captcha_handler() CaptchaResponseSer

Sync solving method

Returns:

CaptchaResponseSer model with full service response

Return type:

CaptchaResponseSer

Notes

Check class docstring for more info

async aio_captcha_handler() CaptchaResponseSer

Async method for captcha solving

Returns:

CaptchaResponseSer model with full service response

Return type:

CaptchaResponseSer

Notes

Check class docstring for more info