search1api 0.2.0__tar.gz → 0.3.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.2.0 → search1api-0.3.0}/PKG-INFO +44 -5
- {search1api-0.2.0 → search1api-0.3.0}/README.md +40 -2
- {search1api-0.2.0 → search1api-0.3.0}/openapi/search1api.openapi.json +723 -35
- {search1api-0.2.0 → search1api-0.3.0}/pyproject.toml +3 -2
- {search1api-0.2.0 → search1api-0.3.0}/src/search1api/__init__.py +1 -1
- {search1api-0.2.0 → search1api-0.3.0}/src/search1api/client.py +117 -5
- {search1api-0.2.0 → search1api-0.3.0}/src/search1api/types.py +54 -1
- {search1api-0.2.0 → search1api-0.3.0}/tests/test_client.py +119 -0
- {search1api-0.2.0 → search1api-0.3.0}/.github/workflows/ci.yml +0 -0
- {search1api-0.2.0 → search1api-0.3.0}/.github/workflows/release.yml +0 -0
- {search1api-0.2.0 → search1api-0.3.0}/.gitignore +0 -0
- {search1api-0.2.0 → search1api-0.3.0}/LICENSE +0 -0
- {search1api-0.2.0 → search1api-0.3.0}/openapi/README.md +0 -0
- {search1api-0.2.0 → search1api-0.3.0}/src/search1api/errors.py +0 -0
- {search1api-0.2.0 → search1api-0.3.0}/src/search1api/py.typed +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: search1api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Official Python client for Search1API
|
|
5
|
-
Project-URL:
|
|
5
|
+
Project-URL: Homepage, https://s1.dev
|
|
6
|
+
Project-URL: Documentation, https://s1.dev/docs/integrations/sdks
|
|
6
7
|
Project-URL: Repository, https://github.com/superagents-lab/search1api-python
|
|
7
8
|
Project-URL: Issues, https://github.com/superagents-lab/search1api-python/issues
|
|
8
9
|
Author: Search1API
|
|
@@ -52,7 +53,7 @@ Description-Content-Type: text/markdown
|
|
|
52
53
|
|
|
53
54
|
Official synchronous and asynchronous Python clients for Search1API.
|
|
54
55
|
|
|
55
|
-
API documentation: [search1api.com/docs](https://
|
|
56
|
+
API documentation: [search1api.com/docs](https://s1.dev/docs)
|
|
56
57
|
|
|
57
58
|
## Install
|
|
58
59
|
|
|
@@ -76,6 +77,12 @@ for result in response["results"]:
|
|
|
76
77
|
print(result["title"], result["link"])
|
|
77
78
|
```
|
|
78
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.
|
|
85
|
+
|
|
79
86
|
Use the client as a context manager when it owns the HTTP connection pool:
|
|
80
87
|
|
|
81
88
|
```python
|
|
@@ -92,6 +99,24 @@ async with AsyncSearch1API() as client:
|
|
|
92
99
|
response = await client.search("latest AI agent frameworks")
|
|
93
100
|
```
|
|
94
101
|
|
|
102
|
+
## Ask
|
|
103
|
+
|
|
104
|
+
`ask` sends a natural-language request and lets Search1API choose the engines
|
|
105
|
+
and time window. It returns at most 10 results ranked by relevance, and
|
|
106
|
+
`intent` reports what was searched:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
answer = client.ask("What are developers saying about Bun 1.3 this month?")
|
|
110
|
+
|
|
111
|
+
print(answer["intent"]["sources"], answer["intent"]["time_range"])
|
|
112
|
+
for result in answer["results"]:
|
|
113
|
+
print(result["relevance"], result["source"], result["title"], result["link"])
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
A completed request costs 5 credits. Ask is not available with pay-per-request
|
|
117
|
+
payments, and its default timeout is 45 seconds. Use `search` when you already
|
|
118
|
+
know which engine and keywords you want.
|
|
119
|
+
|
|
95
120
|
## Deepcrawl
|
|
96
121
|
|
|
97
122
|
`deepcrawl` starts a task and waits for it to finish:
|
|
@@ -125,7 +150,21 @@ The clients also support news, crawl, sitemap, trending, extract, usage, and
|
|
|
125
150
|
batch operations exposed by the Search1API HTTP API. Requests time out after
|
|
126
151
|
30 seconds and retry `429` and transient `5xx` responses twice by default.
|
|
127
152
|
Authentication, payment, and validation errors are never retried. Deepcrawl
|
|
128
|
-
task creation
|
|
153
|
+
task creation and feedback are not retried automatically because they are not
|
|
154
|
+
idempotent.
|
|
155
|
+
|
|
156
|
+
## Feedback
|
|
157
|
+
|
|
158
|
+
`feedback` reports a Search1API problem, missing capability, or confusing
|
|
159
|
+
documentation. It is free. Do not include credentials or personal data:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
client.feedback(
|
|
163
|
+
"Results for this query have no publication dates",
|
|
164
|
+
category="feature_request",
|
|
165
|
+
request_id="the x-search1api-request-id of the original request",
|
|
166
|
+
)
|
|
167
|
+
```
|
|
129
168
|
|
|
130
169
|
## Development
|
|
131
170
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Official synchronous and asynchronous Python clients for Search1API.
|
|
4
4
|
|
|
5
|
-
API documentation: [search1api.com/docs](https://
|
|
5
|
+
API documentation: [search1api.com/docs](https://s1.dev/docs)
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -26,6 +26,12 @@ 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.
|
|
34
|
+
|
|
29
35
|
Use the client as a context manager when it owns the HTTP connection pool:
|
|
30
36
|
|
|
31
37
|
```python
|
|
@@ -42,6 +48,24 @@ async with AsyncSearch1API() as client:
|
|
|
42
48
|
response = await client.search("latest AI agent frameworks")
|
|
43
49
|
```
|
|
44
50
|
|
|
51
|
+
## Ask
|
|
52
|
+
|
|
53
|
+
`ask` sends a natural-language request and lets Search1API choose the engines
|
|
54
|
+
and time window. It returns at most 10 results ranked by relevance, and
|
|
55
|
+
`intent` reports what was searched:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
answer = client.ask("What are developers saying about Bun 1.3 this month?")
|
|
59
|
+
|
|
60
|
+
print(answer["intent"]["sources"], answer["intent"]["time_range"])
|
|
61
|
+
for result in answer["results"]:
|
|
62
|
+
print(result["relevance"], result["source"], result["title"], result["link"])
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
A completed request costs 5 credits. Ask is not available with pay-per-request
|
|
66
|
+
payments, and its default timeout is 45 seconds. Use `search` when you already
|
|
67
|
+
know which engine and keywords you want.
|
|
68
|
+
|
|
45
69
|
## Deepcrawl
|
|
46
70
|
|
|
47
71
|
`deepcrawl` starts a task and waits for it to finish:
|
|
@@ -75,7 +99,21 @@ The clients also support news, crawl, sitemap, trending, extract, usage, and
|
|
|
75
99
|
batch operations exposed by the Search1API HTTP API. Requests time out after
|
|
76
100
|
30 seconds and retry `429` and transient `5xx` responses twice by default.
|
|
77
101
|
Authentication, payment, and validation errors are never retried. Deepcrawl
|
|
78
|
-
task creation
|
|
102
|
+
task creation and feedback are not retried automatically because they are not
|
|
103
|
+
idempotent.
|
|
104
|
+
|
|
105
|
+
## Feedback
|
|
106
|
+
|
|
107
|
+
`feedback` reports a Search1API problem, missing capability, or confusing
|
|
108
|
+
documentation. It is free. Do not include credentials or personal data:
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
client.feedback(
|
|
112
|
+
"Results for this query have no publication dates",
|
|
113
|
+
category="feature_request",
|
|
114
|
+
request_id="the x-search1api-request-id of the original request",
|
|
115
|
+
)
|
|
116
|
+
```
|
|
79
117
|
|
|
80
118
|
## Development
|
|
81
119
|
|