Metadata-Version: 2.5
Name: reserp-haystack
Version: 0.3.0
Summary: Minimal Haystack component for the Reserp Google Search API v2
Project-URL: Homepage, https://reserp.ai/
Project-URL: Documentation, https://reserp.ai/docs
Project-URL: Repository, https://github.com/reserp-ai/reserp-haystack
Project-URL: Issues, https://github.com/reserp-ai/reserp-haystack/issues
Author: Reserp
License: MIT
License-File: LICENSE
Keywords: google-search,haystack,reserp,search-api,serp-api
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: haystack-ai<3,>=2.24.1
Description-Content-Type: text/markdown

# Reserp Haystack Integration

`ReserpWebSearch` exposes the [Reserp Google Search API v2](https://reserp.ai/docs) as a minimal Haystack component.

The component accepts a complete Google Search URL, makes one request to [`POST /v2/serp/search`](https://reserp.ai/docs/search), and returns the public JSON under Haystack's required output key. Its `results[]` array is flat, page ordered, and deduplicated, with optional visible text for each URL. The component adds no retries, timeout policy, concurrency management, caching, queues, result conversion, or automatic pagination.

## Installation

```bash
pip install reserp-haystack
```

## Usage

```python
from haystack.utils import Secret
from haystack_integrations.components.websearch.reserp import ReserpWebSearch

search = ReserpWebSearch(api_key=Secret.from_env_var("RESERP_API_KEY"))
result = search.run(
    url="https://www.google.com/search?q=photonic+computing&gl=us&hl=en"
)["response"]

if result["ok"]:
    for item in result["results"]:
        print(item.get("text"), item["url"])
```

Every successful response includes `pagination.next_url`. Submit that value in a later component call to advance; its presence does not prove another page contains results. Do not infer pagination from `len(result["results"])`.

The surrounding pipeline owns retries, timeouts, task queues, concurrency, observability, and pagination. When the API reports `retryable`, this package exposes that field and takes no action itself.

## Migrating

From 0.2, replace `/v2/serp/urls` with `/v2/serp/search` and `urls[]` with `results[]`. When migrating directly from v1, other notable field renames are `url` → `request.url`, `finalUrl` → `page.url`, `pagination.nextUrl` → `pagination.next_url`, and `billingSource` → `billing_source`.

For typed, page-ordered SERP blocks and explicit positions, call the [structured v2 endpoint](https://reserp.ai/docs/structured) directly or use an official Reserp SDK.

## Resources

- [Reserp API documentation](https://reserp.ai/docs)
- [OpenAPI definition](https://reserp.ai/openapi.json)
- [Postman collection](https://www.postman.com/reserp-ai/reserp-google-search-api)

## License

MIT
