Metadata-Version: 2.4
Name: anysearch-py
Version: 0.2.0
Summary: Typed Python client for AnySearch.
Author: WH-2099
Author-email: WH-2099 <wh2099@pm.me>
License-Expression: MIT
License-File: LICENSE
Requires-Dist: pydantic>=2.12
Requires-Dist: urllib3-future>=2.12.910
Requires-Python: >=3.14
Project-URL: source, https://github.com/WH-2099/anysearch-py
Project-URL: homepage, https://github.com/WH-2099/anysearch-py
Project-URL: issues, https://github.com/WH-2099/anysearch-py/issues
Description-Content-Type: text/markdown

# anysearch-py

Typed Python clients for AnySearch.

The package has two first-class clients.

`Client` calls the REST Web API.

`MCPClient` calls the remote MCP `tools/call` API.

Both clients share the same Pydantic models, enums, validation, and serialization logic.

The API key is optional when the AnySearch endpoint permits anonymous access.

## Install

```bash
uv add anysearch-py
```

## REST Search

```python
from anysearch_py import Client, SearchTag

with Client(api_key="YOUR_ANYSEARCH_API_KEY") as client:
    response = client.search(
        "Python 3.15 new features",
        tag=SearchTag.CODE_DOC,
        params={"library": "python"},
    )

print(response.data.results[0].url)
```

## Async REST Search

```python
import asyncio

from anysearch_py import AsyncClient


async def main() -> None:
    async with AsyncClient(api_key="YOUR_ANYSEARCH_API_KEY") as client:
        response = await client.search("Python 3.15 new features")

    print(response.data.results[0].url)


asyncio.run(main())
```

## MCP Tools

```python
from anysearch_py import Domain, MCPClient

with MCPClient(api_key="YOUR_ANYSEARCH_API_KEY") as client:
    markdown = client.get_sub_domains(domains=[Domain.FINANCE, Domain.HEALTH])

print(markdown)
```

## MCP Search

```python
from anysearch_py import MCPClient

with MCPClient(api_key="YOUR_ANYSEARCH_API_KEY") as client:
    markdown = client.search("Python 3.15 new features", max_results=5)

print(markdown)
```

## Live Tests

Live tests read `ANYSEARCH_API_KEY` from the environment first, then `.env`.

If neither source provides a non-empty value, those tests skip automatically.

Package code never reads `.env`.
