Metadata-Version: 2.4
Name: answerline
Version: 0.1.0
Summary: Python client for the AnswerLine answer and search monitoring API.
Author-email: AnswerLine <support@answerline.dev>
License-Expression: MIT
Project-URL: Homepage, https://answerline.dev
Project-URL: Repository, https://github.com/hsdxpro/answerline
Keywords: answerline,ai,llm,search-api,monitoring,chatgpt,perplexity,gemini
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1,>=0.27
Dynamic: license-file

# answerline

Python client for the [AnswerLine](https://answerline.dev) API — structured JSON answers from AI assistants
(ChatGPT, Perplexity, Gemini, Copilot, Grok) and Google surfaces (Search, News, AI Overview, AI Mode), on httpx.

```bash
pip install answerline
```

```python
from answerline import Client

with Client("sk_...") as client:
    # Synchronous monitor calls: one method per engine (chatgpt, perplexity, gemini,
    # copilot, grok, aimode, google, google_news), or client.monitor(engine, **body).
    answer = client.monitor.chatgpt(prompt="Best CRM for a 5-person team?", country="US")

    # Async tasks: create, poll, or run to a terminal status.
    task = client.async_tasks.run(
        "CHATGPT",
        {"prompt": "Best CRM for a 5-person team?", "country": "US"},
        idempotency_key="crm-1",
    )

    client.credits()  # {"remaining", "perCycle", "cycleResetsAt"}
```

`AsyncClient` has the same methods, awaitable. `async_tasks.create_batch` submits up to 500 tasks in one call;
`async_tasks.wait` polls a task to COMPLETED or FAILED; `async_tasks.status` and `async_tasks.clear_queue` manage
the queue. Prefer a webhook (`webhook_url=` on the task) over polling for many tasks — verify deliveries with
`verify_webhook(body, header, secret)` against the `Webhook-Signature` header.

Calls raise `ApiError` (`status`, stable `code`, parsed `body`, and `meta` with the rate-limit, concurrency, credit
and request-id headers); transport failures raise `TimeoutError` or `ConnectionError`. 429s and safely replayable
failures are retried with jittered backoff; `timeout`, `sync_timeout`, `max_retries` and `http_client` are
constructor options.
