Python hCaptcha solver
Install the official client, pass the sitekey and page URL, and read the token off the solve. The client long-polls for you.
Steps
- Read the sitekey from the widget’s data-sitekey attribute, or from the hCaptcha iframe URL.
- Call VanishCaptcha.solve with type, sitekey, and url. Enterprise pages also pass rqdata.
- Submit solve.token as the form’s h-captcha-response field before the token expires (about two minutes).
sync
from vanishcaptcha import VanishCaptcha vc = VanishCaptcha(api_key="nc_live_...") solve = vc.solve( type="hcaptcha", sitekey="10000000-ffff-ffff-ffff-000000000001", url="https://example.com/login", ) print(solve.token)
asyncio
import asyncio from vanishcaptcha import AsyncVanishCaptcha async def main(): async with AsyncVanishCaptcha(api_key="nc_live_...") as vc: solve = await vc.solve( type="hcaptcha", sitekey="10000000-ffff-ffff-ffff-000000000001", url="https://example.com/login", ) print(solve.token) asyncio.run(main())
requests
import os, requests r = requests.post( "https://api.vanishcaptcha.com/v1/solves", params={"wait": 90}, headers={"Authorization": f"Bearer {os.environ['VANISHCAPTCHA_KEY']}"}, json={ "type": "hcaptcha", "sitekey": "10000000-ffff-ffff-ffff-000000000001", "url": "https://example.com/login", }, timeout=120, ) r.raise_for_status() token = r.json()["token"]
Enterprise rqdata
If the widget carries rqdata, send type: "hcaptcha_enterprise" and that value. The token that comes back is what the enterprise sitekey expects. Fields are in the API reference.
Questions
Does this solve reCAPTCHA or Turnstile?
No. These guides are hCaptcha only. reCAPTCHA and Turnstile are not live on VanishCaptcha.
How long is the token good for?
About two minutes, and it can be submitted once. Request it immediately before the form goes out.