[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-95973":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":15,"starSnapshotCount":15,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},95973,"cloudflare-turnstile-solver","biusberline\u002Fcloudflare-turnstile-solver","biusberline","A small Python library and CLI for working with Cloudflare Turnstile on your own pages - read the sitekey, build the token, verify the result.","",null,"Python",317,26,6,0,72,4.29,"MIT License",false,"main",true,[23,24,25,26,27],"automation","cloudflare","python","solver","turnstile","2026-09-21 02:04:29","\u003Ca href=\"https:\u002F\u002Fpeak.fo\u002F?utm_source=github&utm_medium=readme&utm_campaign=packages&utm_content=cloudflare-turnstile-solver\">\n  \u003Cimg src=\".\u002Fassets\u002Fpeak-banner.png\" alt=\"Peak - solve Cloudflare Turnstile & the 5s challenge in ~1s\" width=\"100%\">\n\u003C\u002Fa>\n\n# Cloudflare Turnstile Solver — Get a Turnstile Token in Python\n\nThe **Cloudflare Turnstile Solver** package makes it easy to work with\nCloudflare Turnstile from Python: it **finds the Turnstile sitekey** on any page,\n**creates a valid Turnstile token** via the Peak API, and hands you a\n`cf-turnstile-response` token you can inject into a form or request. It is a\nsmall, dependency-free library plus a CLI — designed for CI pipelines, QA\nautomation, and integration engineering.\n\n**Table of Contents:**\n- What this package does\n- Quick start\n- Finding a Turnstile sitekey\n- Creating a Turnstile token\n- Python API reference\n- CLI usage\n- Examples\n- Powered by Peak\n- License\n## What this package does\n\nCloudflare Turnstile protects pages with a widget that issues a token. Two things\nare always needed: **find the sitekey** the page is using, and **create a token**\nfor that sitekey. This package provides both:\n\n1. `find_sitekey()` — scan a page for its `data-sitekey`.\n2. `create_token()` — submit a solve task to the Peak API and get a valid token.\n3. `token_for_page()` — do both in one call.\n\nIt has no browser dependency. A single Python file, standard library only, works\non headless servers and CI runners.\n\n## Quick start\n\n```console\n$ export PEAK_API_KEY=pk_your_api_key\n$ python -m cloudflare_turnstile_solver --url https:\u002F\u002Fexample.com\u002F\n0.AgAAABBqzz...\n```\n\nOr find the sitekey first, then create the token:\n\n```python\nfrom cloudflare_turnstile_solver import find_sitekey, create_token\n\nsitekey = find_sitekey(\"https:\u002F\u002Fexample.com\u002F\")\ntoken = create_token(\"pk_...\", sitekey, \"https:\u002F\u002Fexample.com\u002F\")\nprint(token)  # -> \"0.AgAAABBqzz...\"\n```\n\n## Finding a Turnstile sitekey\n\nTurnstile widgets expose the sitekey in the markup:\n\n```html\n\u003Cdiv class=\"cf-turnstile\" data-sitekey=\"0x4AAAAAAAxxxx\">\u003C\u002Fdiv>\n```\n\n`find_sitekey()` reads it for you:\n\n```python\nfrom cloudflare_turnstile_solver import find_sitekey\n\nsitekey = find_sitekey(\"https:\u002F\u002Fexample.com\u002F\")\nprint(sitekey)  # -> \"0x4AAAAAAAxxxx\"\n```\n\nIt also finds `data-action` when present, so tokens are scoped correctly.\n\n## Creating a Turnstile token\n\nA token is tied to the sitekey, the page URL, and optionally the action. To\ncreate one with the Peak API:\n\n```python\nfrom cloudflare_turnstile_solver import create_token\n\nresult = create_token(\"pk_...\", \"0x4AAAAAAAxxxx\", \"https:\u002F\u002Fexample.com\u002F\",\n                      proxy=\"http:\u002F\u002Fu:p@1.2.3.4:8080\")\nprint(result.token)\n```\n\nSubmit the returned token as `cf-turnstile-response`:\n\n```\ncf-turnstile-response: 0.AgAAABBqzz...\n```\n\n> ⚠️ **If the token is rejected**, check the basics. The token is bound to the\n> page URL and environment that created it. Use the same proxy and a matching\n> user agent for the request.\n\n## Python API reference\n\n| Function | Description |\n|----------|-------------|\n| `find_sitekey(url, html=None)` | Scan a page for its Turnstile sitekey. |\n| `find_action(html)` | Find an optional `data-action` value. |\n| `create_token(api_key, sitekey, url, proxy=None, action=None, cdata=None, ...)` | Create a valid token via the Peak API. |\n| `token_for_page(api_key, url, proxy=None, html=None)` | Find the sitekey and create a token in one call. |\n\nAll functions raise `TurnstileTokenError` on failure. `create_token` retries\ntransient failures automatically.\n\n## CLI usage\n\n```console\n$ python -m cloudflare_turnstile_solver --url https:\u002F\u002Fexample.com\u002F --output json\n{\n  \"sitekey\": \"0x4AAAAAAAxxxx\",\n  \"token\": \"0.AgAAABBqzz...\",\n  \"success\": true\n}\n```\n\nFlags: `--url` (required), `--sitekey`, `--proxy`, `--api-key`, `--output\n{text,json}`, `--retries`.\n\n## Examples\n\n### In a script with requests\n\n```python\nimport requests\nfrom cloudflare_turnstile_solver import token_for_page\n\nresult = token_for_page(\"pk_...\", \"https:\u002F\u002Fexample.com\u002F\")\nresp = requests.post(\"https:\u002F\u002Fexample.com\u002Fsubmit\",\n                     data={\"cf-turnstile-response\": result.token})\nprint(resp.status_code)\n```\n\n### In CI \u002F shell\n\n```bash\nTOKEN=$(python -m cloudflare_turnstile_solver --url https:\u002F\u002Fexample.com\u002F)\ncurl -X POST https:\u002F\u002Fexample.com\u002Fsubmit \\\n  -H \"cf-turnstile-response: $TOKEN\" \\\n  -d \"payload=...\"\n```\n\n## Powered by Peak\n\nThis package uses [Peak](https:\u002F\u002Fpeak.fo\u002F?utm_source=github&utm_medium=readme&utm_campaign=packages&utm_content=cloudflare-turnstile-solver) to solve Turnstile.\n\n- ✅ **1,000 free solves to start - no card.** [Grab 1,000 free solves](https:\u002F\u002Fpeak.fo\u002F?utm_source=github&utm_medium=readme&utm_campaign=packages&utm_content=cloudflare-turnstile-solver) and pay only for successful solves.\n- From **$0.8 \u002F 1,000** successful solves.\n- Solve Cloudflare Turnstile & the 5s challenge in about a second.\n\n[Get your free API key](https:\u002F\u002Fpeak.fo\u002F?utm_source=github&utm_medium=readme&utm_campaign=packages&utm_content=cloudflare-turnstile-solver) • [Docs](https:\u002F\u002Fpeak.fo\u002Fdocs\u002Fturnstile?utm_source=github&utm_medium=readme&utm_campaign=packages&utm_content=cloudflare-turnstile-solver) • [Pricing](https:\u002F\u002Fpeak.fo\u002Fpricing?utm_source=github&utm_medium=readme&utm_campaign=packages&utm_content=cloudflare-turnstile-solver)\n\n## FAQ\n\n**Does it run headless \u002F without a browser?**\n\nYes. The whole package is a single Python file on the standard library - no\nbrowser, no webdriver, no Node. It runs the same on a headless CI runner as it\ndoes locally.\n\n**How do I use a proxy?**\n\nPass it to `create_token` \u002F `token_for_page` with the `proxy` argument, or use\n`--proxy` on the CLI:\n\n```console\n$ python -m cloudflare_turnstile_solver --url https:\u002F\u002Fexample.com\u002F --proxy http:\u002F\u002Fu:p@1.2.3.4:8080\n```\n\n**Can I use it for multiple pages on the same site?**\n\nYes - call `token_for_page` per page URL. Each token is bound to the page URL\nit was created for, so don't reuse one token across different pages.\n\n## License\n\nMIT","这是一个用于自动化处理 Cloudflare Turnstile 验证的轻量级 Python 工具库，支持从网页自动提取 Turnstile sitekey 并调用 Peak API 生成有效 token（cf-turnstile-response）。核心功能包括无头环境下的 sitekey 解析、token 创建及 URL\u002FAction\u002F代理等上下文绑定，依赖仅限 Python 标准库，无需浏览器或额外依赖。适用于 CI\u002FCD 流水线、自动化测试、QA 环境集成及后端服务绕过 Turnstile 表单提交等场景。",2,"2026-09-08 02:30:03","CREATED_QUERY"]