Skip to main content

scrapy-proxyhat

Scrapy downloader middleware that routes every request through ProxyHat residential proxies — rotating IPs, geo-targeting, and sticky sessions.

CI PyPI License: MIT

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

Metadata

Release files for scrapy-proxyhat 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapy-proxyhat 0.1.2
File Size Uploaded
scrapy_proxyhat-0.1.2.tar.gz 84.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-proxyhat 0.1.2
File Interpreter ABI Platform
scrapy_proxyhat-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 90.1 kB

Release files / scrapy_proxyhat-0.1.2.tar.gz

Download URL scrapy_proxyhat-0.1.2.tar.gz
Size 84.5 kB
Tags Source
SHA-256 checksum
How to use checksums
08df96fa6ac76ffd666dcb6b34d89c305c074632cdb87c8d880a0572319a6c8f
BLAKE2b-256 checksum
How to use checksums
93b8efa16594021ff4f368f8991c4d711b0c9b811551b90eb1996e5b98e5b6e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.

Transparency log

Release files / scrapy_proxyhat-0.1.2-py3-none-any.whl

Download URL scrapy_proxyhat-0.1.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20a2b825e7b7ffd5d20ad6144433c1c2ec61d10b463979c2f43d1e60cf5475f4
BLAKE2b-256 checksum
How to use checksums
26f5f236c73e08b968c07895b0faef1fc7bd744493ed230cfb72a1db58fa6ebf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page