Use the returned user agent and client hints

By solvethree2 min read

Use the returned browser identity on the request that submits the solution to the target website. Set both headers from the solution and send that request through the proxy that succeeded during solving.

On this page

Replace your existing browser headers

Headers on the outgoing target request
Headers on the outgoing target request
HTTP headerValue from the ready solution
User-Agentsolution.userAgent
sec-ch-uasolution.secChUa

Don't keep a random user agent from your scraper or an existing HTTP session. That replaces the browser identity returned with the solution with an unrelated one. Updating only sec-ch-ua leaves the two headers describing different browsers.

Replace old values rather than appending duplicate headers. Check session defaults or request-building middleware that might overwrite them before the request is sent.

Use the proxy that succeeded

Start with a ready result; pending and solving don't contain a usable solution. The SDK's solve method waits for a ready result or raises an error.

For a task submitted with one proxy, reuse that proxy for the target request. If you supplied proxyCandidates, select the successful proxy with Python's successful_proxy(original_task, ready_result) or JavaScript's successfulProxy(originalTask, readyResult). Don't simply use the first candidate.

The examples below read the outgoing proxy from request's proxy field. For a candidate-based task, put the helper's selected value there before sending the request. See proxy candidate selection for that setup.

Send the target request in Python or Node.js

These examples submit a reCAPTCHA v3 Enterprise token. In Python, solution is the ready result's solution dictionary. In Node.js, result is the ready task. Both examples explicitly set the returned headers and route the request through the selected proxy.

Python requests · apply a ready solution
# Continue after client.solve(). Install requests separately: pip install requests.
import requests

# This example endpoint accepts the standard reCAPTCHA form field.
# Use your application's real URL, form fields, CSRF token and session.
response = requests.post(
    "https://accounts.example.com/login",
    data={"g-recaptcha-response": solution["token"]},
    headers={
        "User-Agent": solution["userAgent"],
        "sec-ch-ua": solution["secChUa"],
    },
    proxies={"http": request["proxy"], "https": request["proxy"]},
    timeout=30,
    allow_redirects=False,
)
# Inspect the application's response to determine whether it accepted the request.
print("Application HTTP status:", response.status_code)

Replace the example login URL with the intended target URL and use that application's actual form fields, CSRF token and session. The samples assume the application accepts the token in g-recaptcha-response; the returned browser headers belong in the HTTP headers, not in the form body.

If the target rejects the request, inspect what actually left your HTTP client: the token value, both browser headers, the proxy and the destination URL. A ready task means a solution was generated, not that the target accepted your submission. The printed application HTTP status is a starting point; check the application's response for its actual success or failure result.

Run your first task.

Start with $5 in workspace credit.

Create a workspace