answerline 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- answerline-0.1.0/LICENSE +21 -0
- answerline-0.1.0/PKG-INFO +57 -0
- answerline-0.1.0/README.md +36 -0
- answerline-0.1.0/pyproject.toml +32 -0
- answerline-0.1.0/setup.cfg +4 -0
- answerline-0.1.0/src/answerline/__init__.py +548 -0
- answerline-0.1.0/src/answerline/py.typed +0 -0
- answerline-0.1.0/src/answerline/webhooks.py +28 -0
- answerline-0.1.0/src/answerline.egg-info/PKG-INFO +57 -0
- answerline-0.1.0/src/answerline.egg-info/SOURCES.txt +15 -0
- answerline-0.1.0/src/answerline.egg-info/dependency_links.txt +1 -0
- answerline-0.1.0/src/answerline.egg-info/requires.txt +1 -0
- answerline-0.1.0/src/answerline.egg-info/top_level.txt +1 -0
- answerline-0.1.0/tests/localhost-cert.pem +11 -0
- answerline-0.1.0/tests/localhost-key.pem +5 -0
- answerline-0.1.0/tests/test_client.py +458 -0
- answerline-0.1.0/tests/test_webhooks.py +57 -0
answerline-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AnswerLine
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: answerline
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the AnswerLine answer and search monitoring API.
|
|
5
|
+
Author-email: AnswerLine <support@answerline.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://answerline.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/hsdxpro/answerline
|
|
9
|
+
Keywords: answerline,ai,llm,search-api,monitoring,chatgpt,perplexity,gemini
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: httpx<1,>=0.27
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# answerline
|
|
23
|
+
|
|
24
|
+
Python client for the [AnswerLine](https://answerline.dev) API — structured JSON answers from AI assistants
|
|
25
|
+
(ChatGPT, Perplexity, Gemini, Copilot, Grok) and Google surfaces (Search, News, AI Overview, AI Mode), on httpx.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install answerline
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from answerline import Client
|
|
33
|
+
|
|
34
|
+
with Client("sk_...") as client:
|
|
35
|
+
# Synchronous monitor calls: one method per engine (chatgpt, perplexity, gemini,
|
|
36
|
+
# copilot, grok, aimode, google, google_news), or client.monitor(engine, **body).
|
|
37
|
+
answer = client.monitor.chatgpt(prompt="Best CRM for a 5-person team?", country="US")
|
|
38
|
+
|
|
39
|
+
# Async tasks: create, poll, or run to a terminal status.
|
|
40
|
+
task = client.async_tasks.run(
|
|
41
|
+
"CHATGPT",
|
|
42
|
+
{"prompt": "Best CRM for a 5-person team?", "country": "US"},
|
|
43
|
+
idempotency_key="crm-1",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
client.credits() # {"remaining", "perCycle", "cycleResetsAt"}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`AsyncClient` has the same methods, awaitable. `async_tasks.create_batch` submits up to 500 tasks in one call;
|
|
50
|
+
`async_tasks.wait` polls a task to COMPLETED or FAILED; `async_tasks.status` and `async_tasks.clear_queue` manage
|
|
51
|
+
the queue. Prefer a webhook (`webhook_url=` on the task) over polling for many tasks — verify deliveries with
|
|
52
|
+
`verify_webhook(body, header, secret)` against the `Webhook-Signature` header.
|
|
53
|
+
|
|
54
|
+
Calls raise `ApiError` (`status`, stable `code`, parsed `body`, and `meta` with the rate-limit, concurrency, credit
|
|
55
|
+
and request-id headers); transport failures raise `TimeoutError` or `ConnectionError`. 429s and safely replayable
|
|
56
|
+
failures are retried with jittered backoff; `timeout`, `sync_timeout`, `max_retries` and `http_client` are
|
|
57
|
+
constructor options.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# answerline
|
|
2
|
+
|
|
3
|
+
Python client for the [AnswerLine](https://answerline.dev) API — structured JSON answers from AI assistants
|
|
4
|
+
(ChatGPT, Perplexity, Gemini, Copilot, Grok) and Google surfaces (Search, News, AI Overview, AI Mode), on httpx.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install answerline
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
from answerline import Client
|
|
12
|
+
|
|
13
|
+
with Client("sk_...") as client:
|
|
14
|
+
# Synchronous monitor calls: one method per engine (chatgpt, perplexity, gemini,
|
|
15
|
+
# copilot, grok, aimode, google, google_news), or client.monitor(engine, **body).
|
|
16
|
+
answer = client.monitor.chatgpt(prompt="Best CRM for a 5-person team?", country="US")
|
|
17
|
+
|
|
18
|
+
# Async tasks: create, poll, or run to a terminal status.
|
|
19
|
+
task = client.async_tasks.run(
|
|
20
|
+
"CHATGPT",
|
|
21
|
+
{"prompt": "Best CRM for a 5-person team?", "country": "US"},
|
|
22
|
+
idempotency_key="crm-1",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
client.credits() # {"remaining", "perCycle", "cycleResetsAt"}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`AsyncClient` has the same methods, awaitable. `async_tasks.create_batch` submits up to 500 tasks in one call;
|
|
29
|
+
`async_tasks.wait` polls a task to COMPLETED or FAILED; `async_tasks.status` and `async_tasks.clear_queue` manage
|
|
30
|
+
the queue. Prefer a webhook (`webhook_url=` on the task) over polling for many tasks — verify deliveries with
|
|
31
|
+
`verify_webhook(body, header, secret)` against the `Webhook-Signature` header.
|
|
32
|
+
|
|
33
|
+
Calls raise `ApiError` (`status`, stable `code`, parsed `body`, and `meta` with the rate-limit, concurrency, credit
|
|
34
|
+
and request-id headers); transport failures raise `TimeoutError` or `ConnectionError`. 429s and safely replayable
|
|
35
|
+
failures are retried with jittered backoff; `timeout`, `sync_timeout`, `max_retries` and `http_client` are
|
|
36
|
+
constructor options.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "answerline"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client for the AnswerLine answer and search monitoring API."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "AnswerLine", email = "support@answerline.dev" }]
|
|
13
|
+
keywords = ["answerline", "ai", "llm", "search-api", "monitoring", "chatgpt", "perplexity", "gemini"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Topic :: Software Development :: Libraries",
|
|
20
|
+
"Typing :: Typed",
|
|
21
|
+
]
|
|
22
|
+
dependencies = ["httpx>=0.27,<1"]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://answerline.dev"
|
|
26
|
+
Repository = "https://github.com/hsdxpro/answerline"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.packages.find]
|
|
29
|
+
where = ["src"]
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.package-data]
|
|
32
|
+
answerline = ["py.typed"]
|