GeeTest

To import this module:

from python3_anticaptcha.gee_test import GeeTest
class python3_anticaptcha.gee_test.GeeTest(api_key: str, captcha_type: CaptchaTypeEnm | str, websiteURL: str, gt: str, version: int = 3, challenge: str | None = None, geetestApiServerSubdomain: str | None = None, initParameters: str | None = None, 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 = 10)
__init__(api_key: str, captcha_type: CaptchaTypeEnm | str, websiteURL: str, gt: str, version: int = 3, challenge: str | None = None, geetestApiServerSubdomain: str | None = None, initParameters: str | None = None, 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 = 10)

The class is used to work with GeeTest.

Parameters:
  • api_key (str) – Capsolver API key

  • captcha_type (CaptchaTypeEnm | str) – Captcha type

  • websiteURL (str) – Address of the webpage

  • gt (str) – The domain public key, rarely updated.

  • version (int) – Version number. Default version is 3. Supported versions: 3 and 4.

  • challenge (str | None) – Changing token key. Make sure you grab a fresh one for each captcha; otherwise, you’ll be charged for an error task. Required for version 3. Not required for version 4

  • geetestApiServerSubdomain (str | None) – Optional API subdomain. May be required for some implementations.

  • initParameters (str | None) – Additional initialization parameters for version 4

  • 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) – The waiting time between requests to get the result of the Captcha

Examples

>>> GeeTest(api_key="99d7d111a0111dc11184111c8bb111da",
...         captcha_type="GeeTestTaskProxyless",
...         websiteURL="https://www.geetest.com/en/adaptive-captcha-demo",
...         gt="81388ea1fc187e0c335c0a8907ff2625",
...         challenge="12345678abc90123d45678ef90123a456b",
...         version=3,
...        ).captcha_handler()
{
   "errorId": 0,
   "errorCode": None,
   "errorDescription": None,
   "status":"ready",
   "solution":{
        "challenge":"3c1c5153aa48011e92883aed820069f3hj",
        "validate":"47ad5a0a6eb98a95b2bcd9e9eecc8272",
        "seccode":"83fa4f2d23005fc91c3a015a1613f803|jordan"
   },
   "cost": 0.002,
   "ip": "46.53.249.230",
   "createTime": 1679004358,
   "endTime": 1679004368,
   "solveCount": 0,
   "taskId": 396687629
}
>>> await GeeTest(api_key="99d7d111a0111dc11184111c8bb111da",
...         captcha_type="GeeTestTaskProxyless",
...         websiteURL="https://www.geetest.com/en/adaptive-captcha-demo",
...         gt="81388ea1fc187e0c335c0a8907ff2625",
...         version=4,
...         initParameters="additional_init_params"
...        ).aio_captcha_handler()
{
   "errorId": 0,
   "errorCode": None,
   "errorDescription": None,
   "status":"ready",
   "solution":{
        "captcha_id": "fcd636b4514bf7ac4143922550b3008b",
        "lot_number": "354ab6dd4e594fdc903074c4d8d37b24",
        "pass_token": "b645946a654e60218c7922......8d660bbd1ed5",
        "gen_time": "1649921519",
        "captcha_output": "cFPIA.....rRoA=="
   },
   "cost": 0.002,
   "ip": "46.53.249.230",
   "createTime": 1679004358,
   "endTime": 1679004368,
   "solveCount": 0,
   "taskId": 396687629
}
>>> GeeTest(api_key="99d7d111a0111dc11184111c8bb111da",
...         captcha_type="GeeTestTask",
...         websiteURL="https://www.geetest.com/en/adaptive-captcha-demo",
...         gt="81388ea1fc187e0c335c0a8907ff2625",
...         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":{
        "challenge":"3c1c5153aa48011e92883aed820069f3hj",
        "validate":"47ad5a0a6eb98a95b2bcd9e9eecc8272",
        "seccode":"83fa4f2d23005fc91c3a015a1613f803|jordan"
   },
   "cost": 0.002,
   "ip": "46.53.249.230",
   "createTime": 1679004358,
   "endTime": 1679004368,
   "solveCount": 0,
   "taskId": 396687629
}
async aio_captcha_handler(**additional_params) dict

Asynchronous method for captcha solving

Parameters:

additional_params – Some additional parameters that will be used in creating the task and will be passed to the payload under task key. Like proxyLogin, proxyPassword and etc. - more info in service docs

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstirng for more info

captcha_handler(**additional_params) dict

Synchronous method for captcha solving

Parameters:

additional_params – Some additional parameters that will be used in creating the task and will be passed to the payload under task key. Like proxyLogin, proxyPassword and etc. - more info in service docs

Returns:

Dict with full server response

Return type:

dict

Notes

Check class docstirng for more info

set_callback_url(callbackUrl: str) None

Method for callbackUrl param set.

Parameters:

callbackUrl (str) –

Optional web address where we can send the results of captcha task processing. Contents are sent by AJAX POST request and are identical

to the contents of getTaskResult method.