Skip to main content

LlamaIndex web reader that loads URLs through ProxyHat residential proxies — rotation, geo-targeting, sticky sessions.

Project description

llamaindex-proxyhat

Read the web in LlamaIndex through ProxyHat residential proxies — a web reader with rotating IPs, geo-targeting, and sticky sessions.

CI Compatible with llama-index-core latest PyPI License: MIT

Why

RAG pipelines that read the open web from datacenter IPs get blocked, rate-limited, and served bot-detection pages instead of content. This package routes LlamaIndex's web reads through ProxyHat's residential IPs (50M+ across 148+ countries) — a fresh IP per page by default, or one pinned IP for a whole multi-page load.

  • ProxyHatWebReader — a BaseReader whose load_data(urls) fetches each URL and returns Document objects for indexing, retrieval, or summarization.

Install

pip install llamaindex-proxyhat

llama-index-core is a peer — bring your own version (>=0.10), the same one your app and other LlamaIndex integrations already use.

Quick start

Load pages as Document objects:

from llamaindex_proxyhat import ProxyHatWebReader

# An API key auto-selects an active residential sub-user:
reader = ProxyHatWebReader(
    api_key="ph_your_api_key",
    country="us",
)

docs = reader.load_data(["https://example.com", "https://example.org"])

for doc in docs:
    print(doc.metadata["url"], doc.metadata["status_code"], len(doc.text))

Feed the documents straight into an index:

from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_documents(docs)
answer = index.as_query_engine().query("What does the page say?")

Get an API key at proxyhat.com.

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

ProxyHatWebReader(
    api_key="ph_your_api_key",
    country="us",        # ISO code or "any" (default)
    region="california",
    city="new_york",
    filter="high",       # AI IP-quality tier
    sticky="30m",        # keep one IP across the whole load; omit for rotating
    protocol="http",     # or "socks5"
)

Each Document carries text (the response body) and metadata with url, status_code, and content_type.

Rotating vs sticky

By default the reader is rotating: each page is fetched over a new connection with a stable gateway username, so ProxyHat hands out a fresh residential IP per page. Set sticky (e.g. sticky="30m" or sticky=True) to pin one residential IP across every page in the load_data call — the right choice for paginated sites, logged-in sessions, or anything that must look like a single user.

How it works

ProxyHatWebReader subclasses BaseReader (llama_index.core.readers.base) and returns Document objects (llama_index.core). It resolves your gateway credentials once (via the official proxyhat SDK — an API key auto-picks an active sub-user, or you supply username/password directly), then builds a ProxyHat gateway connection URL with the SDK's targeting grammar and fetches each URL through it with httpx. Rotating loads reuse a stable username so the gateway rotates the IP per connection; sticky loads reuse one session id (a single httpx client) so every request exits from the same IP.

Publishing to the LlamaHub / LlamaIndex integrations registry is a planned follow-up.

License

MIT © ProxyHat

Project details


Download files

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

Source Distribution

llamaindex_proxyhat-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

llamaindex_proxyhat-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file llamaindex_proxyhat-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for llamaindex_proxyhat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1da826243508a67d12917bb71de0af4aa608c6a5e75d147a1ab83d325a7b77cc
MD5 71262a9168fb1e403afb8ba39499814e
BLAKE2b-256 7a8c29e903c01f35401414af138e65dee951c46eab5c8c3e637c044d1218e063

See more details on using hashes here.

Provenance

The following attestation bundles were made for llamaindex_proxyhat-0.1.0.tar.gz:

Publisher: ci.yml on ProxyHatCom/llamaindex-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 llamaindex_proxyhat-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llamaindex_proxyhat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af1e6e87b1286cedb4e29c06ab509501bf3adad8b331e28be18d6d4a222db2dc
MD5 66a079742fce8fb50b9b37f82e043229
BLAKE2b-256 7e5da05b62e7c05ef12e65475e9071091552a78a1c490f40e7617bed0c908548

See more details on using hashes here.

Provenance

The following attestation bundles were made for llamaindex_proxyhat-0.1.0-py3-none-any.whl:

Publisher: ci.yml on ProxyHatCom/llamaindex-proxyhat

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page