Get actual User-Agent
get_actual_user_agentGet a current Windows User-Agent string to avoid CAPTCHA token rejection. Use the same UA across browser context and CapMonster tasks to ensure matching fingerprints.
Instructions
Fetch a current, real-world (Windows) User-Agent string from CapMonster's UA service.
Use ONE User-Agent as a single fingerprint thread across the whole solve — they must all match or the solved token is likely to be rejected:
set it as the patchright browser context's UA (browser-launch flag / device emulation), so the page is loaded with it;
pass the SAME string as the
userAgentfield of any CapMonster task that accepts one (reCAPTCHA, Turnstile/Cloudflare, FunCaptcha, AWS WAF, DataDome, Imperva, Yidun, TenDI, …);when the solution comes back with its own
userAgent(orheaders["User-Agent"]), the token is bound to THAT value — reuse it for the injection and any follow-up requests instead of your original.
CapMonster requires a current Windows-OS UA; a stale/invalid one fails with ERROR_WRONG_USERAGENT, so re-fetch here rather than reusing an old one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||