Use task type waf when your application will perform the request after the
challenge has been solved.
Request data
| Field | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | URL that returned the Cloudflare challenge |
proxy |
string | Yes | Sticky proxy used for the original and follow-up requests |
user_agent |
string | No | User-Agent from the challenged client |
html |
string | No | Challenge response HTML |
When omitted, user_agent defaults to:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36Almost all User-Agents are supported, including Safari, Chrome, and Firefox on Windows, macOS, Linux, Android, and iOS.
{
"url": "https://example.com/protected",
"proxy": "http://user:[email protected]:8080",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...",
"html": "<html>...</html>"
}Solution
| Field | Type | Description |
|---|---|---|
clearance |
string | Value for the cf_clearance cookie |
cf_bm |
string or null | Optional value for the __cf_bm cookie |
cf_rt |
string or null | Optional first-request __cf_chl_tk query value |
headers |
object | Browser headers used during the solve |
attributes |
object | Form fields for the first follow-up POST |
{
"clearance": "abc123...",
"cf_bm": "xyz789...",
"cf_rt": "token123...",
"headers": {
"user-agent": "Mozilla/5.0 ...",
"sec-ch-ua": "\"Chromium\";v=\"143\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\""
},
"attributes": {
"a": "value1",
"b": "value2"
}
}Apply the solution
Reuse the same proxy
Make the follow-up request through the exact proxy used for the solve.
Set the cookies and headers
Set cf_clearance and, when present, __cf_bm. Reuse the returned headers
exactly, especially user-agent and Client Hints.
Build the first request
Make a POST request to the original challenged URL. Set Referer to that
same URL; when cf_rt is present, add it to the Referer query string as
__cf_chl_tk while preserving any existing query parameters. Send
attributes as the form body using
application/x-www-form-urlencoded. Python wreq performs the encoding
when you pass form=solution.get("attributes", {}).