piloterr-haystack
Haystack integration for Piloterr, a web data API.
It adds two components:
PiloterrWebSearchsearches Google and returns the results as HaystackDocuments.PiloterrFetcherfetches web pages through Piloterr and returns their HTML asByteStreams, like Haystack'sLinkContentFetcher.
Piloterr downloads each page on its own infrastructure, in one of three ways:
crawler: plain HTTP, the default;rendering: a headless browser, for JavaScript pages;webunlocker: for pages behind anti-bot protection.
Installation
pip install piloterr-haystack
Get an API key at app.piloterr.com and set it in the environment:
export PILOTERR_API_KEY="your-api-key"
Web search
from haystack_integrations.components.websearch.piloterr import PiloterrWebSearch
search = PiloterrWebSearch(top_k=5, search_params={"gl": "us", "hl": "en"})
result = search.run(query="What is Haystack?")
run returns two outputs:
documents: oneDocumentper organic result, with the snippet as content andtitle,linkandpositionin the metadata;links: the result URLs.
| Parameter | Default | Description |
|---|---|---|
api_key |
Secret.from_env_var("PILOTERR_API_KEY") |
Piloterr API key |
top_k |
10 |
Results requested from Google, 1 to 100 |
allowed_domains |
Only search these domains, added to the query as site: filters |
|
search_params |
Extra parameters, such as gl, hl or location |
|
timeout |
60 |
Seconds to wait for Piloterr |
Fetching pages
from haystack import Pipeline
from haystack.components.converters import HTMLToDocument
from haystack_integrations.components.fetchers.piloterr import PiloterrFetcher
pipeline = Pipeline()
pipeline.add_component("fetcher", PiloterrFetcher(engine="rendering", wait_in_seconds=2))
pipeline.add_component("converter", HTMLToDocument())
pipeline.connect("fetcher.streams", "converter.sources")
result = pipeline.run({"fetcher": {"urls": ["https://example.com"]}})
print(result["converter"]["documents"][0].content)
| Parameter | Default | Description |
|---|---|---|
api_key |
Secret.from_env_var("PILOTERR_API_KEY") |
Piloterr API key |
engine |
crawler |
crawler, rendering or webunlocker |
wait_in_seconds |
Rendering only: extra wait after the page loads, 0 to 30 | |
raise_on_failure |
True |
Raise when a single URL fails; with several URLs, failures are logged and skipped |
timeout |
120 |
Seconds to wait for each page |
Each stream's metadata holds url, content_type and engine.
A failed request raises PiloterrError, a Haystack ComponentError with the HTTP status. The API key never appears in the message. Piloterr reports a rate limit as HTTP 401 with "Rate limit exceeded", and the error says so. Both components have run_async too.
Development
pip install -e ".[test]"
pytest -m "not integration" # offline
PILOTERR_API_KEY=... pytest # with the live tests
License
MIT
Metadata
Release files for piloterr-haystack 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| piloterr_haystack-0.1.0.tar.gz | 9.0 kB | Without provenance | Details for piloterr_haystack-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| piloterr_haystack-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for piloterr_haystack-0.1.0-py3-none-any.whl |
Total release size: 19.6 kB
Release files / piloterr_haystack-0.1.0.tar.gz
| Download URL | piloterr_haystack-0.1.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f181465f4092659290ffdafb8ea346026083a3f2a7dd6d2e383256bac16066ef
|
|
BLAKE2b-256 checksum How to use checksums |
f455db8c07e7b0421f9add8774bfecf9b4afb7d178cece513e587b70be0e6700
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / piloterr_haystack-0.1.0-py3-none-any.whl
| Download URL | piloterr_haystack-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5193e8500ac7c20f8eeb62417ede6035a9f58f06c271ec5503609589f251ecff
|
|
BLAKE2b-256 checksum How to use checksums |
c22aa8da9ac984180f0d029d0c8a5e598f05ffeed9f28aa86139d77b44c67d41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for piloterr-haystack 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.