Scrapy downloader middleware for ProxyHat residential proxies — rotation, geo-targeting, sticky sessions.
Project description
scrapy-proxyhat
Scrapy downloader middleware that routes every request through ProxyHat residential proxies — rotating IPs, geo-targeting, and sticky sessions.
Why
Scraping at scale from datacenter IPs gets you blocked and rate-limited. This middleware sends your Scrapy requests out through ProxyHat's residential IPs (50M+ across 148+ countries), with a fresh IP per request by default — no boilerplate.
Install
pip install scrapy-proxyhat
Setup
# settings.py
DOWNLOADER_MIDDLEWARES = {
"scrapy_proxyhat.ProxyHatMiddleware": 610,
}
# Simplest — an API key auto-selects an active residential sub-user:
PROXYHAT_API_KEY = "ph_your_api_key"
# ...or explicit gateway credentials:
# PROXYHAT_USERNAME = "your-proxy-username"
# PROXYHAT_PASSWORD = "your-proxy-password"
# Optional targeting:
PROXYHAT_COUNTRY = "us" # ISO code or "any" (default)
# PROXYHAT_REGION = "california"
# PROXYHAT_CITY = "new_york"
# PROXYHAT_STICKY = "30m" # keep one IP; omit for rotating
# PROXYHAT_FILTER = "high" # AI IP-quality tier
# PROXYHAT_SUBUSER = "<uuid or name>" # pick a specific sub-user (with API key)
Get an API key at proxyhat.com.
Per-request targeting
Override any setting per request via meta (keys are proxyhat_<setting>):
yield scrapy.Request(
url,
meta={"proxyhat_country": "de", "proxyhat_sticky": "30m"},
)
A request that already has meta["proxy"] set is left untouched.
How it works
The middleware builds a ProxyHat gateway connection URL (via the official proxyhat SDK) and sets request.meta["proxy"]. Scrapy's built-in HttpProxyMiddleware (priority 750, runs after this one at 610) moves the credentials into the Proxy-Authorization header. Rotating targeting reuses a stable username so the gateway hands out a fresh residential IP per connection; sticky targeting pins one IP for the session.
License
MIT © ProxyHat
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrapy_proxyhat-0.1.0.tar.gz.
File metadata
- Download URL: scrapy_proxyhat-0.1.0.tar.gz
- Upload date:
- Size: 84.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68998b36c7ccbca07f4d45d5f5deddb08f7a881866628824fed583b992e54bea
|
|
| MD5 |
b347211ae61d4e55d3dce85e0e1027dd
|
|
| BLAKE2b-256 |
aa02fe54cb042423e2e6ae770bef7170443d1a638ed084ba32b42d2e4ad6226f
|
Provenance
The following attestation bundles were made for scrapy_proxyhat-0.1.0.tar.gz:
Publisher:
ci.yml on ProxyHatCom/scrapy-proxyhat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scrapy_proxyhat-0.1.0.tar.gz -
Subject digest:
68998b36c7ccbca07f4d45d5f5deddb08f7a881866628824fed583b992e54bea - Sigstore transparency entry: 2163524668
- Sigstore integration time:
-
Permalink:
ProxyHatCom/scrapy-proxyhat@b9ba530a689eaa42df43d532953ec53fa32b746d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ProxyHatCom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@b9ba530a689eaa42df43d532953ec53fa32b746d -
Trigger Event:
push
-
Statement type:
File details
Details for the file scrapy_proxyhat-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scrapy_proxyhat-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfdb17a9bae464367c0134d77e5a4c0a4f66b1407dcf551e9d902db778339501
|
|
| MD5 |
30a480664c7d30fc96329f7638d47255
|
|
| BLAKE2b-256 |
2f506a3bb45d1436484b000fac23b391f77360220ee50c33c7945420988a9d35
|
Provenance
The following attestation bundles were made for scrapy_proxyhat-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on ProxyHatCom/scrapy-proxyhat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scrapy_proxyhat-0.1.0-py3-none-any.whl -
Subject digest:
bfdb17a9bae464367c0134d77e5a4c0a4f66b1407dcf551e9d902db778339501 - Sigstore transparency entry: 2163524690
- Sigstore integration time:
-
Permalink:
ProxyHatCom/scrapy-proxyhat@b9ba530a689eaa42df43d532953ec53fa32b746d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ProxyHatCom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@b9ba530a689eaa42df43d532953ec53fa32b746d -
Trigger Event:
push
-
Statement type: