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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrapy_proxyhat-0.1.1.tar.gz (84.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrapy_proxyhat-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file scrapy_proxyhat-0.1.1.tar.gz.

File metadata

  • Download URL: scrapy_proxyhat-0.1.1.tar.gz
  • Upload date:
  • Size: 84.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scrapy_proxyhat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c14f957c1f6b49644fca0aadec02ef8ca105303d7b72d8e3405e20e0f08852d1
MD5 9d26c3325710cce59d35fa472044f049
BLAKE2b-256 1d3ed34aca145ac444071add0c236a6cd6d631728d8dc80b7351bd09d073812a

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapy_proxyhat-0.1.1.tar.gz:

Publisher: ci.yml on ProxyHatCom/scrapy-proxyhat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scrapy_proxyhat-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for scrapy_proxyhat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dab02cf6c5fb78098ca80c574f2d859edd5bfe653b4ad82b1ecbe2fa388ea651
MD5 1fdc79a35edc9dd92be80147dbcdc8fe
BLAKE2b-256 ab78b9c476002eccde1ea57b406b8f9fb3b1e14ceb4782629d1e25419e5a5f66

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapy_proxyhat-0.1.1-py3-none-any.whl:

Publisher: ci.yml on ProxyHatCom/scrapy-proxyhat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 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