Fetcher
A basicFetcher class that performs synchronous HTTP requests based on curl_cffi.
Methods
get()
Perform a GET request.Target URL for the request
Query string parameters for the request
Headers to include in the request
Cookies to use in the request
Number of seconds to wait before timing out
Whether to follow redirects
Maximum number of redirects. Use -1 for unlimited
Number of retry attempts
Number of seconds to wait between retry attempts
Dict of proxies to use. Format:
{"http": proxy_url, "https": proxy_url}Proxy URL to use. Format:
"http://username:password@localhost:8030"HTTP basic auth for proxy, tuple of (username, password)
HTTP basic auth tuple of (username, password). Only basic auth is supported
Whether to verify HTTPS certificates
Tuple of (cert, key) filenames for the client certificate
Browser version to impersonate. Automatically defaults to the latest available Chrome version
Whether to use HTTP3. Might be problematic if used with
impersonateIf enabled, creates and adds real browser headers
A Response object containing the fetched page data
post()
Perform a POST request.Target URL for the request
Form data to include in the request body
A JSON serializable object to include in the body of the request
get().
A Response object containing the fetched page data
put()
Perform a PUT request.post().
A Response object containing the fetched page data
delete()
Perform a DELETE request.post().
Be careful of sending a body in a DELETE request, as it might cause some websites to reject the request per RFC 7231. However, some websites accept it depending on their implementation.
A Response object containing the fetched page data
AsyncFetcher
A basicFetcher class that performs asynchronous HTTP requests based on curl_cffi.
Methods
get()
Perform an asynchronous GET request.Fetcher.get().
An awaitable Response object containing the fetched page data
post()
Perform an asynchronous POST request.Fetcher.post().
An awaitable Response object containing the fetched page data
put()
Perform an asynchronous PUT request.Fetcher.put().
An awaitable Response object containing the fetched page data
delete()
Perform an asynchronous DELETE request.Fetcher.delete().
An awaitable Response object containing the fetched page data
Configuration
BothFetcher and AsyncFetcher inherit from BaseFetcher and support global configuration:
configure()
Set parser arguments globally for all requests.Enable parsing of huge HTML trees
Enable adaptive parsing mode
Storage system class to use
Keep CDATA sections in parsed content
Additional arguments for the storage system
Keep HTML comments in parsed content
Domain to use for adaptive parsing
display_config()
Display the current configuration.Dictionary containing all current parser configuration values