search1api 0.2.1__tar.gz → 0.4.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.
- search1api-0.4.0/CHANGELOG.md +5 -0
- {search1api-0.2.1 → search1api-0.4.0}/PKG-INFO +44 -2
- {search1api-0.2.1 → search1api-0.4.0}/README.md +43 -1
- {search1api-0.2.1 → search1api-0.4.0}/openapi/search1api.openapi.json +512 -9
- {search1api-0.2.1 → search1api-0.4.0}/pyproject.toml +1 -1
- {search1api-0.2.1 → search1api-0.4.0}/src/search1api/__init__.py +1 -1
- {search1api-0.2.1 → search1api-0.4.0}/src/search1api/client.py +117 -5
- {search1api-0.2.1 → search1api-0.4.0}/src/search1api/types.py +58 -1
- {search1api-0.2.1 → search1api-0.4.0}/tests/test_client.py +152 -0
- {search1api-0.2.1 → search1api-0.4.0}/.github/workflows/ci.yml +0 -0
- {search1api-0.2.1 → search1api-0.4.0}/.github/workflows/release.yml +0 -0
- {search1api-0.2.1 → search1api-0.4.0}/.gitignore +0 -0
- {search1api-0.2.1 → search1api-0.4.0}/LICENSE +0 -0
- {search1api-0.2.1 → search1api-0.4.0}/openapi/README.md +0 -0
- {search1api-0.2.1 → search1api-0.4.0}/src/search1api/errors.py +0 -0
- {search1api-0.2.1 → search1api-0.4.0}/src/search1api/py.typed +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.0 - 2026-10-12
|
|
4
|
+
|
|
5
|
+
Breaking: search/news engine-specific fields move from each result's top level to optional `metadata` (`kind`, `stars`, `language`, `num_comments`, `points`, `story_url`). Read e.g. `result.metadata.stars` instead of `result.stars`. `published_date` stays at the top level. No legacy field aliases.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: search1api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Official Python client for Search1API
|
|
5
5
|
Project-URL: Homepage, https://s1.dev
|
|
6
6
|
Project-URL: Documentation, https://s1.dev/docs/integrations/sdks
|
|
@@ -77,6 +77,16 @@ for result in response["results"]:
|
|
|
77
77
|
print(result["title"], result["link"])
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
`search_service` selects one engine (`google` by default), for example `bing`,
|
|
81
|
+
`bingcn`, `yandex`, `reddit`, `github`, `arxiv`, `wikipedia`, or `grokipedia`.
|
|
82
|
+
`page` requests a later results page on engines with native pagination
|
|
83
|
+
(`bing`, `bingcn`, `baidu`, `grokipedia`). Results carry `published_date` when the source
|
|
84
|
+
exposes one. Engine-specific fields are in each result's optional `metadata`:
|
|
85
|
+
GitHub uses `metadata.kind`, `metadata.stars`, `metadata.language`, and
|
|
86
|
+
`metadata.num_comments`; Hacker News news results use `metadata.story_url`,
|
|
87
|
+
`metadata.points`, and `metadata.num_comments`. The former top-level paths
|
|
88
|
+
are removed in 0.4.0; `published_date` stays at the top level.
|
|
89
|
+
|
|
80
90
|
Use the client as a context manager when it owns the HTTP connection pool:
|
|
81
91
|
|
|
82
92
|
```python
|
|
@@ -93,6 +103,24 @@ async with AsyncSearch1API() as client:
|
|
|
93
103
|
response = await client.search("latest AI agent frameworks")
|
|
94
104
|
```
|
|
95
105
|
|
|
106
|
+
## Ask
|
|
107
|
+
|
|
108
|
+
`ask` sends a natural-language request and lets Search1API choose the engines
|
|
109
|
+
and time window. It returns at most 10 results ranked by relevance, and
|
|
110
|
+
`intent` reports what was searched:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
answer = client.ask("What are developers saying about Bun 1.3 this month?")
|
|
114
|
+
|
|
115
|
+
print(answer["intent"]["sources"], answer["intent"]["time_range"])
|
|
116
|
+
for result in answer["results"]:
|
|
117
|
+
print(result["relevance"], result["source"], result["title"], result["link"])
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
A completed request costs 5 credits. Ask is not available with pay-per-request
|
|
121
|
+
payments, and its default timeout is 45 seconds. Use `search` when you already
|
|
122
|
+
know which engine and keywords you want.
|
|
123
|
+
|
|
96
124
|
## Deepcrawl
|
|
97
125
|
|
|
98
126
|
`deepcrawl` starts a task and waits for it to finish:
|
|
@@ -126,7 +154,21 @@ The clients also support news, crawl, sitemap, trending, extract, usage, and
|
|
|
126
154
|
batch operations exposed by the Search1API HTTP API. Requests time out after
|
|
127
155
|
30 seconds and retry `429` and transient `5xx` responses twice by default.
|
|
128
156
|
Authentication, payment, and validation errors are never retried. Deepcrawl
|
|
129
|
-
task creation
|
|
157
|
+
task creation and feedback are not retried automatically because they are not
|
|
158
|
+
idempotent.
|
|
159
|
+
|
|
160
|
+
## Feedback
|
|
161
|
+
|
|
162
|
+
`feedback` reports a Search1API problem, missing capability, or confusing
|
|
163
|
+
documentation. It is free. Do not include credentials or personal data:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
client.feedback(
|
|
167
|
+
"Results for this query have no publication dates",
|
|
168
|
+
category="feature_request",
|
|
169
|
+
request_id="the x-search1api-request-id of the original request",
|
|
170
|
+
)
|
|
171
|
+
```
|
|
130
172
|
|
|
131
173
|
## Development
|
|
132
174
|
|
|
@@ -26,6 +26,16 @@ for result in response["results"]:
|
|
|
26
26
|
print(result["title"], result["link"])
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
`search_service` selects one engine (`google` by default), for example `bing`,
|
|
30
|
+
`bingcn`, `yandex`, `reddit`, `github`, `arxiv`, `wikipedia`, or `grokipedia`.
|
|
31
|
+
`page` requests a later results page on engines with native pagination
|
|
32
|
+
(`bing`, `bingcn`, `baidu`, `grokipedia`). Results carry `published_date` when the source
|
|
33
|
+
exposes one. Engine-specific fields are in each result's optional `metadata`:
|
|
34
|
+
GitHub uses `metadata.kind`, `metadata.stars`, `metadata.language`, and
|
|
35
|
+
`metadata.num_comments`; Hacker News news results use `metadata.story_url`,
|
|
36
|
+
`metadata.points`, and `metadata.num_comments`. The former top-level paths
|
|
37
|
+
are removed in 0.4.0; `published_date` stays at the top level.
|
|
38
|
+
|
|
29
39
|
Use the client as a context manager when it owns the HTTP connection pool:
|
|
30
40
|
|
|
31
41
|
```python
|
|
@@ -42,6 +52,24 @@ async with AsyncSearch1API() as client:
|
|
|
42
52
|
response = await client.search("latest AI agent frameworks")
|
|
43
53
|
```
|
|
44
54
|
|
|
55
|
+
## Ask
|
|
56
|
+
|
|
57
|
+
`ask` sends a natural-language request and lets Search1API choose the engines
|
|
58
|
+
and time window. It returns at most 10 results ranked by relevance, and
|
|
59
|
+
`intent` reports what was searched:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
answer = client.ask("What are developers saying about Bun 1.3 this month?")
|
|
63
|
+
|
|
64
|
+
print(answer["intent"]["sources"], answer["intent"]["time_range"])
|
|
65
|
+
for result in answer["results"]:
|
|
66
|
+
print(result["relevance"], result["source"], result["title"], result["link"])
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
A completed request costs 5 credits. Ask is not available with pay-per-request
|
|
70
|
+
payments, and its default timeout is 45 seconds. Use `search` when you already
|
|
71
|
+
know which engine and keywords you want.
|
|
72
|
+
|
|
45
73
|
## Deepcrawl
|
|
46
74
|
|
|
47
75
|
`deepcrawl` starts a task and waits for it to finish:
|
|
@@ -75,7 +103,21 @@ The clients also support news, crawl, sitemap, trending, extract, usage, and
|
|
|
75
103
|
batch operations exposed by the Search1API HTTP API. Requests time out after
|
|
76
104
|
30 seconds and retry `429` and transient `5xx` responses twice by default.
|
|
77
105
|
Authentication, payment, and validation errors are never retried. Deepcrawl
|
|
78
|
-
task creation
|
|
106
|
+
task creation and feedback are not retried automatically because they are not
|
|
107
|
+
idempotent.
|
|
108
|
+
|
|
109
|
+
## Feedback
|
|
110
|
+
|
|
111
|
+
`feedback` reports a Search1API problem, missing capability, or confusing
|
|
112
|
+
documentation. It is free. Do not include credentials or personal data:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
client.feedback(
|
|
116
|
+
"Results for this query have no publication dates",
|
|
117
|
+
category="feature_request",
|
|
118
|
+
request_id="the x-search1api-request-id of the original request",
|
|
119
|
+
)
|
|
120
|
+
```
|
|
79
121
|
|
|
80
122
|
## Development
|
|
81
123
|
|