ProxyHat residential proxies for ScrapeGraphAI — inject a geo-targeted, sticky-or-rotating proxy straight into your graph_config.
Project description
scrapegraphai-proxyhat
Route ScrapeGraphAI LLM scraping graphs through ProxyHat residential proxies — a geo-targeted, sticky-by-default residential IP dropped straight into your graph_config.
Why
ScrapeGraphAI drives a real browser (Playwright) to render pages before the LLM reads them. From a datacenter IP that browser gets flagged, CAPTCHA-walled, and blocked. This package plugs ProxyHat's residential IPs (50M+ across 148+ countries) into ScrapeGraphAI through the exact hook it already supports — graph_config["loader_kwargs"]["proxy"] — with one pinned residential IP for the whole scrape by default, so pagination and JS interactions stay on one consistent identity. No fork, no boilerplate.
Install
pip install scrapegraphai-proxyhat scrapegraphai
scrapegraphai is a heavy peer dependency (LLM + Playwright stack) — bring your own version. The config builders (proxyhat_graph_config(), proxyhat_proxy()) work on their own; you only need scrapegraphai installed to actually run a graph.
Quick start
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai_proxyhat import proxyhat_graph_config
# An API key auto-selects an active residential sub-user:
graph_config = proxyhat_graph_config(
{"llm": {"model": "openai/gpt-4o-mini"}},
country="us", # sticky US residential IP for the whole scrape
)
scraper = SmartScraperGraph(
prompt="List every project with its title and description.",
source="https://perinim.github.io/projects/",
config=graph_config,
)
print(scraper.run())
Get an API key at proxyhat.com.
proxyhat_graph_config(base_config, ...) merges the proxy into loader_kwargs.proxy and preserves everything else in your config (llm, verbose, headless, any existing loader_kwargs). Your base_config is never mutated.
Just want the proxy dict for a config you build yourself?
from scrapegraphai_proxyhat import proxyhat_proxy
graph_config = {
"llm": {"model": "openai/gpt-4o-mini"},
"loader_kwargs": {"proxy": proxyhat_proxy(country="de", sticky="1h")},
}
# proxyhat_proxy(...) -> {"server": "http://gate.proxyhat.com:8080", "username": ..., "password": ...}
Or the raw URL string (proxyhat_proxy_url(...)) for any other tool:
from scrapegraphai_proxyhat import proxyhat_proxy_url
url = proxyhat_proxy_url(country="us")
# http://<user>-country-us-sid-<id>-ttl-30m:<pass>@gate.proxyhat.com:8080
Credentials
Pass them explicitly or via environment variables — options win over env:
| Option | Env var | Notes |
|---|---|---|
api_key |
PROXYHAT_API_KEY |
Auto-selects an active sub-user with remaining traffic |
sub_user |
PROXYHAT_SUBUSER |
Pick a specific sub-user by uuid or name (with an API key) |
username |
PROXYHAT_USERNAME |
Explicit gateway proxy_username (skips the API) |
password |
PROXYHAT_PASSWORD |
Explicit gateway proxy_password |
Targeting
proxyhat_graph_config(
base_config,
protocol="http", # or "socks5"
country="us", # ISO code or "any" (default)
region="california",
city="los_angeles",
filter="high", # AI IP-quality tier
sticky="30m", # session lifetime (default); sticky=False rotates every request
)
All three builders (proxyhat_graph_config, proxyhat_proxy, proxyhat_proxy_url) take the same targeting keyword arguments.
Sticky IP per scrape (default)
A single scrape often hits the same site many times — rendering, scrolling, following pagination, retrying. If the exit IP changed mid-scrape the site would see a visitor teleporting between cities and block it. So this package is sticky by default: one residential IP is pinned for the whole run (sticky="30m"), keeping the session coherent.
Want a fresh IP on every request instead (e.g. a SearchGraph fanning out across many independent pages)? Turn stickiness off:
proxyhat_graph_config(base_config, country="us", sticky=False) # rotating residential IP per connection
Set a custom lifetime with sticky="2h".
How it works
ScrapeGraphAI reads a proxy at graph_config["loader_kwargs"]["proxy"] and hands it to its ChromiumLoader (and on to Playwright) as a Playwright-style {server, username, password} mapping. proxyhat_proxy(...) resolves your gateway credentials (via the official proxyhat SDK — an API key auto-picks an active sub-user, or pass username/password), then builds exactly that mapping: server is the ProxyHat gateway (http://gate.proxyhat.com:8080, or socks5://…:1080) and username carries ProxyHat's targeting grammar (<user>-country-us-sid-<id>-ttl-30m). proxyhat_graph_config(...) just merges that dict into loader_kwargs.proxy over your config. A sticky username pins one residential IP; a rotating one makes the gateway hand out a fresh IP per connection.
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 scrapegraphai_proxyhat-0.1.0.tar.gz.
File metadata
- Download URL: scrapegraphai_proxyhat-0.1.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb7b13b078937e8a9f700fbd5267d80742acbd8acd6950b5a6a74f768024f6b8
|
|
| MD5 |
64989a6513c291808bf0be3329edd6d7
|
|
| BLAKE2b-256 |
cfb41bae6180665a0b897ee1ff1a7eb315cf25e23dbf3b7ed02a0d28b9ef75a3
|
Provenance
The following attestation bundles were made for scrapegraphai_proxyhat-0.1.0.tar.gz:
Publisher:
ci.yml on ProxyHatCom/scrapegraphai-proxyhat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scrapegraphai_proxyhat-0.1.0.tar.gz -
Subject digest:
eb7b13b078937e8a9f700fbd5267d80742acbd8acd6950b5a6a74f768024f6b8 - Sigstore transparency entry: 2165351875
- Sigstore integration time:
-
Permalink:
ProxyHatCom/scrapegraphai-proxyhat@8db1691a87c87f324fb819c8bb1922710f2c2576 -
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@8db1691a87c87f324fb819c8bb1922710f2c2576 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scrapegraphai_proxyhat-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scrapegraphai_proxyhat-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.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 |
e140e097f4a79ea79b1de4a22e5fb9b92246a708d9034d9eb264be6e1bdb6c6b
|
|
| MD5 |
75d4b80592ea27024a0b17237f1d8061
|
|
| BLAKE2b-256 |
a3c5682fbe550365dc41aa40c897d38218ecbfaff0d6aa69c704fb5b8dfbbaf5
|
Provenance
The following attestation bundles were made for scrapegraphai_proxyhat-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on ProxyHatCom/scrapegraphai-proxyhat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scrapegraphai_proxyhat-0.1.0-py3-none-any.whl -
Subject digest:
e140e097f4a79ea79b1de4a22e5fb9b92246a708d9034d9eb264be6e1bdb6c6b - Sigstore transparency entry: 2165351936
- Sigstore integration time:
-
Permalink:
ProxyHatCom/scrapegraphai-proxyhat@8db1691a87c87f324fb819c8bb1922710f2c2576 -
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@8db1691a87c87f324fb819c8bb1922710f2c2576 -
Trigger Event:
push
-
Statement type: