Fetcher class provides fast HTTP requests with browser impersonation capabilities. Built on curl_cffi, it supports HTTP/1.1, HTTP/2, and HTTP/3 with automatic TLS fingerprint spoofing.
Basic Usage
One-Off Requests
Use the static methods for simple, one-off requests:With FetcherSession
For multiple requests to the same domain, useFetcherSession to maintain cookies and connection pooling:
Key Features
Browser Impersonation
Impersonate real browser TLS fingerprints to avoid detection:chrome, firefox135, safari, edge, and more.
Stealthy Headers
Automatic generation of realistic browser headers:- Realistic User-Agent
- Accept headers matching the browser
- Accept-Language
- Referer from Google search (optional)
HTTP/3 Support
Request Parameters
GET Request
POST/PUT/DELETE Request
Session Configuration
Default Settings
Configure default settings for all requests in a session:Proxy Configuration
Async Support
FetcherSession supports both sync and async contexts:Error Handling
Response Object
All requests return aResponse object with the parsed HTML:
Best Practices
Use sessions for multiple requests
Use sessions for multiple requests
Always use
FetcherSession when making multiple requests to the same domain. This maintains cookies and improves performance through connection pooling.Enable stealthy headers
Enable stealthy headers
Set
stealthy_headers=True to automatically generate realistic browser headers and avoid simple bot detection.Choose the right impersonation
Choose the right impersonation
The default
impersonate='chrome' works for most cases. Use a list to randomly rotate between browsers.Handle retries gracefully
Handle retries gracefully
Configure
retries and retry_delay based on your target’s rate limits. Higher values are better for unstable connections.Comparison with Other Fetchers
Next Steps
Stealthy Mode
Bypass anti-bot systems with StealthyFetcher
Sessions
Learn about persistent sessions
Proxy Rotation
Rotate proxies automatically