Glossary
Python Requests: simple HTTP, easy to recognize
Requests is a widely used Python library for making HTTP calls, loved for its simple API and recognized by bot checks almost as quickly as it is installed.
Why it is everywhere
Requests made HTTP in Python pleasant. One call fetches a page, JSON bodies encode with a keyword, cookies and redirects are handled for you. Countless tutorials, SDKs and internal tools use it, and for talking to APIs, including a CAPTCHA solving API, it remains a fine choice.
Sessions
A Session keeps cookies between calls, reuses TCP connections through a pool, and applies default headers to every request. Use one per logical visitor; it is faster and it carries the cookies a site sets after a challenge is passed.
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
visitor = requests.Session()
visitor.headers["Accept-Language"] = "en-US,en;q=0.9"
again = Retry(total=4, backoff_factor=1, status_forcelist=[500, 502, 503, 504])
visitor.mount("https://", HTTPAdapter(max_retries=again))
page = visitor.get("https://example.com/list", timeout=(5, 30))
print(page.status_code, visitor.cookies.get_dict())
Always pass a timeout. Without one, a call can hang indefinitely (see timeout).
Why it is easy to fingerprint
From a bot check's point of view, Requests stands out in several ways at once.
- User agent. The default is
python-requests/plus a version number, which announces itself. - Header set and order. Even with a browser user agent, the default headers are few and ordered differently from Chrome or Firefox.
- TLS handshake. Requests uses Python's ssl module through urllib3, so cipher suites and extensions differ from any browser. A JA3 style fingerprint identifies it regardless of headers.
- HTTP version. It speaks HTTP/1.1 only, while browsers use HTTP/2 or HTTP/3 with sites that support them.
- No JavaScript. Any check that runs a script in the page simply never completes.
Changing the user agent fixes the first item only. Libraries that imitate browser TLS and HTTP/2, such as curl_cffi, close more of the gap (see curl_cffi in Python).
Using it with a solving API
For talking to GateSolver, Requests is all you need: two JSON POSTs and a loop.
job = requests.post("https://gatesolver.com/createTask", json={"clientKey": "YOUR_API_KEY",
"task": {"type": "AntiTurnstileTaskProxyLess",
"websiteURL": "https://example.com/login",
"websiteKey": "0x4AAAAAAA..."}}, timeout=20).json()
Then poll /getTaskResult with the task ID every three seconds until the status is ready or failed. With a Cloudflare Turnstile widget, plan on under 3 seconds per answer. Send it in the form field the page expects, from the same session.
Proxies and cookies
Set a proxies mapping on the session to route traffic through a proxy, and keep the same proxy for the whole session when a site binds its clearance cookie to an IP. Cookies set by the server land in session.cookies automatically; to reuse a cookie obtained elsewhere, such as a clearance cookie from a challenge task, add it to that jar with the right domain before the next request.
When to move on
Requests is synchronous. For many parallel fetches, look at httpx or aiohttp for async code, or use threads (see multi-threaded scraping). For protected targets, a browser or a browser like client is often needed before any token helps.
Common questions
What user agent does Requests send by default?
python-requests followed by the library version, which makes it obvious to any server log or bot check.
Does changing the user agent make Requests look like a browser?
Only partly. The header order, TLS handshake and HTTP version still differ from real browsers.
Does Requests support HTTP/2?
No. It speaks HTTP/1.1. Libraries such as httpx offer HTTP/2 support.
Why should I always set a timeout?
Without a timeout a request can wait forever on a stalled connection and freeze your worker.
Is Requests good enough for calling GateSolver?
Yes. The API is plain JSON over HTTPS, so two POST calls and a polling loop are all you need.
Keep reading
- curl_cffi for browser-like requestsSend Python requests whose TLS and HTTP/2 fingerprints match a real browser, with impersonate profiles, sessions, async and proxies.
- Scraping with HTTPXHTTPX for scrapers: HTTP/2 on one connection, timeouts split by phase, connection limits, event hooks, and the same code sync or async.
- TLS fingerprintingThe ClientHello message reveals which library opened the connection, which is why Python requests never looks like Chrome.
- Solve Cloudflare Turnstile in PythonAn asyncio and aiohttp client for Turnstile tasks, with action and cData passed through and the token posted as cf-turnstile-response.