Use proxies with Python HTTP clients and Scrapy
Covers configuration sources, authentication, and export validation for Requests, HTTPX, aiohttp, urllib3, curl_cffi, and web parser libraries.
When accessing the Python tool, distinguish between the library responsible for web requests and the library responsible for parsing pages only. The difference between dynamic and static ZZHTTP is that the connection field source and the request library configuration can be shared.
Step 1: Get ZZHTTP Proxy Information
- ** Rotating residential proxies **: Go to "Rotating Residential → Proxy setup → Endpoint generator", get
us.zzhttp.comPort7878(a) the full generated agent username and password for the corresponding sub-account. The protocol is selected by tool, HTTP or SOCKS5 TCP. First, confirm the real name, interests, shared traffic, and sub-account status. - Static residential proxies: Go to "Static residential proxies Network → IP Management" and copy the actual IP, port and independent agent accounts of delivered, available and unexpired instances. Static purchases do not require identity verification and do not use dynamic gateways, sub-accounts or customer IP allowlists.
See the detailed steps for access.Username & password and First connection of static residential. The proxy password is not the console login password.
Step Two: Select the tool port
| Tools | Configuration input | Points of Use |
|---|---|---|
| Requests | Request or Session proxies | Both HTTP and HTTPS targets can use HTTP proxy URLs, see Existing Python examples |
| HTTPX | Client proxy | Check the parameters by install version, see HTTPX examples |
| aiohttp | Requested proxy and proxy_auth | Endpoints are separate from BasicAuth, see aiohttp example |
| urllib3 | ProxyManager and proxy_headers | Use proxy authentication headers, not send authentication headers to target sites |
| curl_cffi | Session or request proxy options | Configure HTTP proxy and authentication according to the current version of the library, not assume that the proxy is enabled because of the presence of the fingerprint option |
| Scrapy | Request meta['proxy']- I'm not sure. | (a) Certification is handled by the corresponding intermediary. Checks on a request-by-request basis, not considering global variables as configurations in effect |
| Beautiful Soup, PyQuery, lxml | The request library with the configured proxy first gets the body and then passes it to the parser | The parser does not automatically inherit other process agents. If you call the self-connection function, check its network entry separately |
Prefer separate authentication fields when the library provides them. When embedding credentials in a proxy URL, URL-encode the username and password individually so special characters such as @ and : are interpreted correctly. Keep the proxy URL scheme set to http:// when connecting to HTTPS destinations through an HTTP proxy.
Step 3: Save and run the minimum request
- Reads host, port, username, password from environment variables or private running configuration, and fills in the corresponding parameters for the selected library.
- Set a reasonable timeout, verify with a single request first, and avoid using a large batch of capture tasks as a first test.
- Checks whether the library reads the system proxy variable, bypasses the list, or uses another Session to ensure that the actual request uses this configuration.
- The response is then passed to the parser, which checks the status code and content type, and does not parse the error page into normal data.
Step 4: Verification and clearance
Request access from the same Client / Session / Scrapy https://ipinfo.io/json The targets were then visited and tested. The results of the analysis cannot in themselves prove the validity of the agent.
- 407: Dynamic checks completed to generate user names, sub-accounts and rights. Static checks instance-independent credentials and validity.
- Parameter error: Check the library version, interface changes to libraries such as HTTPX cannot be used with other library parameters.
- TLS Failed: Checks certificate trust with target site, not masking issue by closing certificate validation.
- Parsed as empty: Check the HTTP status and response body first, then check the selector, a successful proxy connection does not guarantee page structure.
- Exports repeatedly change: dynamic tasks require stable sessions Sticky sessions; Static without dynamic session parameters.
For current library options, see the Requests Proxy Documentation, HTTPX Proxy Documentation, aiohttp proxy support, urllib3 Agent Description, Scrapy Agent Middleware and curl_cffi proxy example.
Did this answer your question?
Feedback is used only to improve the public documentation and does not submit accounts or request information.