searlo 0.2.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.
- searlo-0.2.0/CHANGELOG.md +50 -0
- searlo-0.2.0/LICENSE +21 -0
- searlo-0.2.0/MANIFEST.in +2 -0
- searlo-0.2.0/PKG-INFO +210 -0
- searlo-0.2.0/README.md +173 -0
- searlo-0.2.0/pyproject.toml +68 -0
- searlo-0.2.0/searlo/__init__.py +28 -0
- searlo-0.2.0/searlo/client.py +416 -0
- searlo-0.2.0/searlo/exceptions.py +24 -0
- searlo-0.2.0/searlo/langchain_tool.py +67 -0
- searlo-0.2.0/searlo/py.typed +0 -0
- searlo-0.2.0/searlo.egg-info/PKG-INFO +210 -0
- searlo-0.2.0/searlo.egg-info/SOURCES.txt +17 -0
- searlo-0.2.0/searlo.egg-info/dependency_links.txt +1 -0
- searlo-0.2.0/searlo.egg-info/requires.txt +8 -0
- searlo-0.2.0/searlo.egg-info/top_level.txt +1 -0
- searlo-0.2.0/setup.cfg +4 -0
- searlo-0.2.0/tests/test_client.py +77 -0
- searlo-0.2.0/tests/test_package.py +86 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `searlo` are listed here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## 0.2.0: first public release
|
|
8
|
+
|
|
9
|
+
### Search
|
|
10
|
+
|
|
11
|
+
- `search`, `images`, `news`, `videos`, `site_search`, `advanced`,
|
|
12
|
+
`suggestions`, `trending` and `batch` (up to 10 queries per call).
|
|
13
|
+
- The full results page and verticals: `serp`, `maps`, `shopping`, `scholar`
|
|
14
|
+
and `patents`.
|
|
15
|
+
|
|
16
|
+
### Web data
|
|
17
|
+
|
|
18
|
+
- `scrape`, `map`, `extract`, `search_and_scrape`, `screenshot` and `pdf`.
|
|
19
|
+
- Jobs: `batch_scrape`, `crawl`, `crawl_status`, `crawl_results`,
|
|
20
|
+
`cancel_crawl` and `crawls`.
|
|
21
|
+
- `max_age` freshness control and in-page `actions` on `scrape`.
|
|
22
|
+
- snake_case keyword arguments are sent as the API's camelCase names
|
|
23
|
+
(`only_main_content=True` becomes `onlyMainContent`).
|
|
24
|
+
- Each web-data call has its own timeout (60 to 120 s), so a slow render is
|
|
25
|
+
not cut off at the 15 s search default.
|
|
26
|
+
|
|
27
|
+
### AI answers, email and account
|
|
28
|
+
|
|
29
|
+
- `ai()` asks an AI answer engine and returns the answer with its citations.
|
|
30
|
+
- `verify_email()`, `capabilities()` and `balance()`.
|
|
31
|
+
|
|
32
|
+
### Integrations
|
|
33
|
+
|
|
34
|
+
- `SearloSearchTool` for LangChain (`pip install "searlo[langchain]"`).
|
|
35
|
+
|
|
36
|
+
### Package
|
|
37
|
+
|
|
38
|
+
- Typed errors: `SearloError`, `SearloAPIError`, `SearloAuthError`,
|
|
39
|
+
`SearloInsufficientCreditsError` and `SearloRateLimitError`.
|
|
40
|
+
- Ships `py.typed`. Python 3.9 or newer; the only runtime dependency is
|
|
41
|
+
`requests`.
|
|
42
|
+
|
|
43
|
+
### Not included yet
|
|
44
|
+
|
|
45
|
+
- Structured AI answers (a `schema` field map on `ai()`). The API cannot accept
|
|
46
|
+
it on `GET /search/ai` yet. It will come back in a minor release once it can.
|
|
47
|
+
|
|
48
|
+
## 0.1.0
|
|
49
|
+
|
|
50
|
+
Internal version. It was never published.
|
searlo-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Searlo
|
|
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.
|
searlo-0.2.0/MANIFEST.in
ADDED
searlo-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: searlo
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Official Python client for the Searlo API — search, web data, AI answers and email verification
|
|
5
|
+
Author-email: Searlo <hello@searlo.tech>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://searlo.tech
|
|
8
|
+
Project-URL: Documentation, https://searlo.tech/docs
|
|
9
|
+
Project-URL: Source, https://github.com/eCodeVoyager/searlo-python
|
|
10
|
+
Project-URL: Issues, https://github.com/eCodeVoyager/searlo-python/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/eCodeVoyager/searlo-python/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: searlo,search-api,serp,serp-api,web-search,news-search,maps,shopping,web-scraping,crawler,ai-answers,email-verification,langchain,ai-agents,llm,mcp
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.9
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: requests>=2.28
|
|
31
|
+
Provides-Extra: langchain
|
|
32
|
+
Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: responses>=0.23; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# searlo
|
|
39
|
+
|
|
40
|
+
Official Python client for the [Searlo](https://searlo.tech) API: live search
|
|
41
|
+
results as clean JSON. Web, news, maps, shopping, full results pages, AI
|
|
42
|
+
answers, web data and email verification, with one API key and one credit pool.
|
|
43
|
+
|
|
44
|
+
## Quick start
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install searlo
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from searlo import Searlo
|
|
52
|
+
searlo = Searlo(api_key="sk_...") # or set SEARLO_API_KEY
|
|
53
|
+
print(searlo.search("best crm for startups")["organic"])
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Get a free API key with 3,000 credits (no card required) at
|
|
57
|
+
[dashboard.searlo.tech](https://dashboard.searlo.tech).
|
|
58
|
+
|
|
59
|
+
## Working with results
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from searlo import Searlo
|
|
63
|
+
|
|
64
|
+
searlo = Searlo() # reads SEARLO_API_KEY
|
|
65
|
+
|
|
66
|
+
results = searlo.search("best crm for startups", gl="us", num=10)
|
|
67
|
+
for item in results["organic"]:
|
|
68
|
+
print(item["position"], item["title"], item["link"])
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Methods
|
|
72
|
+
|
|
73
|
+
### Search
|
|
74
|
+
|
|
75
|
+
| Method | Endpoint | Notes |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `search(query, **opts)` | `/search/web` | Organic results, knowledge panels, snippets |
|
|
78
|
+
| `images(query, **opts)` | `/search/images` | Image search |
|
|
79
|
+
| `news(query, **opts)` | `/search/news` | News search |
|
|
80
|
+
| `videos(query, **opts)` | `/search/videos` | Video search |
|
|
81
|
+
| `site_search(query, site, **opts)` | `/search/site` | `site:` operator |
|
|
82
|
+
| `advanced(query, **opts)` | `/search/advanced` | File type, exact/exclude terms |
|
|
83
|
+
| `suggestions(query, **opts)` | `/search/suggestions` | Autocomplete |
|
|
84
|
+
| `trending(region)` | `/search/trending` | Free, no credits charged |
|
|
85
|
+
| `batch(queries)` | `/search/batch` | Up to 10 queries per call |
|
|
86
|
+
| `shopping(query, **opts)` | `/search/shopping` | Products, prices, merchants |
|
|
87
|
+
| `serp(query, **opts)` | `/search/serp` | Full results page: AI overview, ads, related questions, knowledge panel |
|
|
88
|
+
| `maps(query, **opts)` | `/search/maps` | Maps and local results |
|
|
89
|
+
| `scholar(query, **opts)` | `/search/scholar` | Scholarly articles and citations |
|
|
90
|
+
| `patents(query, **opts)` | `/search/patents` | Patents |
|
|
91
|
+
|
|
92
|
+
### Web data
|
|
93
|
+
|
|
94
|
+
| Method | Endpoint | Notes |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `scrape(url, **opts)` | `/scrape` | One URL as markdown, html, links, tables, JSON-LD |
|
|
97
|
+
| `map(url, **opts)` | `/map` | Every URL a site publishes |
|
|
98
|
+
| `extract(urls, schema, **opts)` | `/extract` | URLs + field schema → structured data |
|
|
99
|
+
| `search_and_scrape(query, **opts)` | `/search-and-scrape` | Search, then fetch the top results |
|
|
100
|
+
| `batch_scrape(urls, **opts)` | `/scrape/batch` | Up to 1000 URLs as one job |
|
|
101
|
+
| `crawl(url, **opts)` | `/crawl` | Start a crawl job |
|
|
102
|
+
| `crawl_status(job_id)` | `/crawl/:id` | Job status and progress |
|
|
103
|
+
| `crawl_results(job_id, ...)` | `/crawl/:id/results` | Cursor-paginated results |
|
|
104
|
+
| `cancel_crawl(job_id)` | `/crawl/:id` | Cancel; fetched pages are kept |
|
|
105
|
+
| `crawls(...)` | `/crawl` | List your jobs |
|
|
106
|
+
| `screenshot(url, **opts)` | `/screenshot` | Rendered screenshot |
|
|
107
|
+
| `pdf(url, **opts)` | `/pdf` | Rendered PDF |
|
|
108
|
+
|
|
109
|
+
### AI answers and email
|
|
110
|
+
|
|
111
|
+
| Method | Endpoint | Notes |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `ai(query, engine=...)` | `/search/ai` | An AI answer engine's answer, with the sources it cited |
|
|
114
|
+
| `verify_email(email)` | `/email-verifier/verify` | Real SMTP probe |
|
|
115
|
+
|
|
116
|
+
### Account
|
|
117
|
+
|
|
118
|
+
| Method | Endpoint | Notes |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| `capabilities()` | `/search/capabilities` | What this deployment serves, and its prices |
|
|
121
|
+
| `balance()` | `/credit/balance` | Current account credit balance |
|
|
122
|
+
|
|
123
|
+
Keyword arguments are written in Python and converted for you:
|
|
124
|
+
`only_main_content=True` is sent as `onlyMainContent`.
|
|
125
|
+
|
|
126
|
+
## Freshness and cost
|
|
127
|
+
|
|
128
|
+
Web-data calls take `max_age`: the oldest cached answer you will accept, in
|
|
129
|
+
seconds. `0` always fetches live.
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
searlo.scrape("https://example.com/", max_age=300) # <= 5 minutes old
|
|
133
|
+
searlo.scrape("https://example.com/", max_age=0) # always live
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
A cache hit costs 1 credit. A fetch **your freshness request forces** costs 2.
|
|
137
|
+
A plain cache miss, where you asked for no particular freshness, stays at 1.
|
|
138
|
+
|
|
139
|
+
## Pages behind an interaction
|
|
140
|
+
|
|
141
|
+
`actions` runs an ordered sequence before the page is read. Every step is
|
|
142
|
+
best-effort and each one's outcome comes back with the content.
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
page = searlo.scrape(
|
|
146
|
+
"https://example.com/search",
|
|
147
|
+
actions=[
|
|
148
|
+
{"type": "click", "selector": "#accept-cookies"},
|
|
149
|
+
{"type": "type", "selector": "#q", "text": "coffee"},
|
|
150
|
+
{"type": "press", "selector": "#q", "key": "Enter"},
|
|
151
|
+
{"type": "waitForSelector", "selector": ".results"},
|
|
152
|
+
],
|
|
153
|
+
)
|
|
154
|
+
print(page["actions"]) # [{"type": "click", "ok": True}, ...]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## AI answers
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
answer = searlo.ai("which crm do startups use", engine="gemini")
|
|
161
|
+
print(answer["answer"]) # the answer text
|
|
162
|
+
print(answer["citations"]) # each source it cited
|
|
163
|
+
print(answer["sources"]) # the unique cited domains
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Each engine has its own price per answer; `capabilities()` lists them.
|
|
167
|
+
|
|
168
|
+
## LangChain
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
pip install "searlo[langchain]"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from langchain.agents import create_agent
|
|
176
|
+
from searlo import SearloSearchTool
|
|
177
|
+
|
|
178
|
+
search = SearloSearchTool(api_key="sk_...") # or set SEARLO_API_KEY
|
|
179
|
+
print(search.invoke({"query": "best crm for startups"}))
|
|
180
|
+
|
|
181
|
+
agent = create_agent(model="anthropic:claude-sonnet-4-6", tools=[search])
|
|
182
|
+
agent.invoke({"messages": [{"role": "user", "content": "Which CRMs do startups use?"}]})
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`create_agent` comes from the `langchain` package (1.0 or newer); the tool
|
|
186
|
+
itself only needs `langchain-core`.
|
|
187
|
+
|
|
188
|
+
## Errors
|
|
189
|
+
|
|
190
|
+
All errors subclass `searlo.SearloError`. Specific subclasses:
|
|
191
|
+
`SearloAuthError` (bad key), `SearloInsufficientCreditsError` (402),
|
|
192
|
+
`SearloRateLimitError` (429), `SearloAPIError` (everything else, has
|
|
193
|
+
`.status_code` / `.retryable` / `.error_code`).
|
|
194
|
+
|
|
195
|
+
## Requirements
|
|
196
|
+
|
|
197
|
+
Python 3.9+. The only runtime dependency is `requests`.
|
|
198
|
+
|
|
199
|
+
## Links
|
|
200
|
+
|
|
201
|
+
- Docs: [searlo.tech/docs](https://searlo.tech/docs)
|
|
202
|
+
- MCP server for AI agents: [searlo.tech/mcp](https://searlo.tech/mcp)
|
|
203
|
+
- Changelog: [CHANGELOG.md](https://github.com/eCodeVoyager/searlo-python/blob/main/CHANGELOG.md)
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT
|
|
208
|
+
|
|
209
|
+
Searlo is not affiliated with or endorsed by Google LLC or any other search
|
|
210
|
+
engine or AI provider. All trademarks belong to their owners.
|
searlo-0.2.0/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# searlo
|
|
2
|
+
|
|
3
|
+
Official Python client for the [Searlo](https://searlo.tech) API: live search
|
|
4
|
+
results as clean JSON. Web, news, maps, shopping, full results pages, AI
|
|
5
|
+
answers, web data and email verification, with one API key and one credit pool.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install searlo
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from searlo import Searlo
|
|
15
|
+
searlo = Searlo(api_key="sk_...") # or set SEARLO_API_KEY
|
|
16
|
+
print(searlo.search("best crm for startups")["organic"])
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Get a free API key with 3,000 credits (no card required) at
|
|
20
|
+
[dashboard.searlo.tech](https://dashboard.searlo.tech).
|
|
21
|
+
|
|
22
|
+
## Working with results
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from searlo import Searlo
|
|
26
|
+
|
|
27
|
+
searlo = Searlo() # reads SEARLO_API_KEY
|
|
28
|
+
|
|
29
|
+
results = searlo.search("best crm for startups", gl="us", num=10)
|
|
30
|
+
for item in results["organic"]:
|
|
31
|
+
print(item["position"], item["title"], item["link"])
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Methods
|
|
35
|
+
|
|
36
|
+
### Search
|
|
37
|
+
|
|
38
|
+
| Method | Endpoint | Notes |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `search(query, **opts)` | `/search/web` | Organic results, knowledge panels, snippets |
|
|
41
|
+
| `images(query, **opts)` | `/search/images` | Image search |
|
|
42
|
+
| `news(query, **opts)` | `/search/news` | News search |
|
|
43
|
+
| `videos(query, **opts)` | `/search/videos` | Video search |
|
|
44
|
+
| `site_search(query, site, **opts)` | `/search/site` | `site:` operator |
|
|
45
|
+
| `advanced(query, **opts)` | `/search/advanced` | File type, exact/exclude terms |
|
|
46
|
+
| `suggestions(query, **opts)` | `/search/suggestions` | Autocomplete |
|
|
47
|
+
| `trending(region)` | `/search/trending` | Free, no credits charged |
|
|
48
|
+
| `batch(queries)` | `/search/batch` | Up to 10 queries per call |
|
|
49
|
+
| `shopping(query, **opts)` | `/search/shopping` | Products, prices, merchants |
|
|
50
|
+
| `serp(query, **opts)` | `/search/serp` | Full results page: AI overview, ads, related questions, knowledge panel |
|
|
51
|
+
| `maps(query, **opts)` | `/search/maps` | Maps and local results |
|
|
52
|
+
| `scholar(query, **opts)` | `/search/scholar` | Scholarly articles and citations |
|
|
53
|
+
| `patents(query, **opts)` | `/search/patents` | Patents |
|
|
54
|
+
|
|
55
|
+
### Web data
|
|
56
|
+
|
|
57
|
+
| Method | Endpoint | Notes |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `scrape(url, **opts)` | `/scrape` | One URL as markdown, html, links, tables, JSON-LD |
|
|
60
|
+
| `map(url, **opts)` | `/map` | Every URL a site publishes |
|
|
61
|
+
| `extract(urls, schema, **opts)` | `/extract` | URLs + field schema → structured data |
|
|
62
|
+
| `search_and_scrape(query, **opts)` | `/search-and-scrape` | Search, then fetch the top results |
|
|
63
|
+
| `batch_scrape(urls, **opts)` | `/scrape/batch` | Up to 1000 URLs as one job |
|
|
64
|
+
| `crawl(url, **opts)` | `/crawl` | Start a crawl job |
|
|
65
|
+
| `crawl_status(job_id)` | `/crawl/:id` | Job status and progress |
|
|
66
|
+
| `crawl_results(job_id, ...)` | `/crawl/:id/results` | Cursor-paginated results |
|
|
67
|
+
| `cancel_crawl(job_id)` | `/crawl/:id` | Cancel; fetched pages are kept |
|
|
68
|
+
| `crawls(...)` | `/crawl` | List your jobs |
|
|
69
|
+
| `screenshot(url, **opts)` | `/screenshot` | Rendered screenshot |
|
|
70
|
+
| `pdf(url, **opts)` | `/pdf` | Rendered PDF |
|
|
71
|
+
|
|
72
|
+
### AI answers and email
|
|
73
|
+
|
|
74
|
+
| Method | Endpoint | Notes |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `ai(query, engine=...)` | `/search/ai` | An AI answer engine's answer, with the sources it cited |
|
|
77
|
+
| `verify_email(email)` | `/email-verifier/verify` | Real SMTP probe |
|
|
78
|
+
|
|
79
|
+
### Account
|
|
80
|
+
|
|
81
|
+
| Method | Endpoint | Notes |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| `capabilities()` | `/search/capabilities` | What this deployment serves, and its prices |
|
|
84
|
+
| `balance()` | `/credit/balance` | Current account credit balance |
|
|
85
|
+
|
|
86
|
+
Keyword arguments are written in Python and converted for you:
|
|
87
|
+
`only_main_content=True` is sent as `onlyMainContent`.
|
|
88
|
+
|
|
89
|
+
## Freshness and cost
|
|
90
|
+
|
|
91
|
+
Web-data calls take `max_age`: the oldest cached answer you will accept, in
|
|
92
|
+
seconds. `0` always fetches live.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
searlo.scrape("https://example.com/", max_age=300) # <= 5 minutes old
|
|
96
|
+
searlo.scrape("https://example.com/", max_age=0) # always live
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
A cache hit costs 1 credit. A fetch **your freshness request forces** costs 2.
|
|
100
|
+
A plain cache miss, where you asked for no particular freshness, stays at 1.
|
|
101
|
+
|
|
102
|
+
## Pages behind an interaction
|
|
103
|
+
|
|
104
|
+
`actions` runs an ordered sequence before the page is read. Every step is
|
|
105
|
+
best-effort and each one's outcome comes back with the content.
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
page = searlo.scrape(
|
|
109
|
+
"https://example.com/search",
|
|
110
|
+
actions=[
|
|
111
|
+
{"type": "click", "selector": "#accept-cookies"},
|
|
112
|
+
{"type": "type", "selector": "#q", "text": "coffee"},
|
|
113
|
+
{"type": "press", "selector": "#q", "key": "Enter"},
|
|
114
|
+
{"type": "waitForSelector", "selector": ".results"},
|
|
115
|
+
],
|
|
116
|
+
)
|
|
117
|
+
print(page["actions"]) # [{"type": "click", "ok": True}, ...]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## AI answers
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
answer = searlo.ai("which crm do startups use", engine="gemini")
|
|
124
|
+
print(answer["answer"]) # the answer text
|
|
125
|
+
print(answer["citations"]) # each source it cited
|
|
126
|
+
print(answer["sources"]) # the unique cited domains
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Each engine has its own price per answer; `capabilities()` lists them.
|
|
130
|
+
|
|
131
|
+
## LangChain
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pip install "searlo[langchain]"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from langchain.agents import create_agent
|
|
139
|
+
from searlo import SearloSearchTool
|
|
140
|
+
|
|
141
|
+
search = SearloSearchTool(api_key="sk_...") # or set SEARLO_API_KEY
|
|
142
|
+
print(search.invoke({"query": "best crm for startups"}))
|
|
143
|
+
|
|
144
|
+
agent = create_agent(model="anthropic:claude-sonnet-4-6", tools=[search])
|
|
145
|
+
agent.invoke({"messages": [{"role": "user", "content": "Which CRMs do startups use?"}]})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`create_agent` comes from the `langchain` package (1.0 or newer); the tool
|
|
149
|
+
itself only needs `langchain-core`.
|
|
150
|
+
|
|
151
|
+
## Errors
|
|
152
|
+
|
|
153
|
+
All errors subclass `searlo.SearloError`. Specific subclasses:
|
|
154
|
+
`SearloAuthError` (bad key), `SearloInsufficientCreditsError` (402),
|
|
155
|
+
`SearloRateLimitError` (429), `SearloAPIError` (everything else, has
|
|
156
|
+
`.status_code` / `.retryable` / `.error_code`).
|
|
157
|
+
|
|
158
|
+
## Requirements
|
|
159
|
+
|
|
160
|
+
Python 3.9+. The only runtime dependency is `requests`.
|
|
161
|
+
|
|
162
|
+
## Links
|
|
163
|
+
|
|
164
|
+
- Docs: [searlo.tech/docs](https://searlo.tech/docs)
|
|
165
|
+
- MCP server for AI agents: [searlo.tech/mcp](https://searlo.tech/mcp)
|
|
166
|
+
- Changelog: [CHANGELOG.md](https://github.com/eCodeVoyager/searlo-python/blob/main/CHANGELOG.md)
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT
|
|
171
|
+
|
|
172
|
+
Searlo is not affiliated with or endorsed by Google LLC or any other search
|
|
173
|
+
engine or AI provider. All trademarks belong to their owners.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "searlo"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Official Python client for the Searlo API — search, web data, AI answers and email verification"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
authors = [{ name = "Searlo", email = "hello@searlo.tech" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"searlo",
|
|
16
|
+
"search-api",
|
|
17
|
+
"serp",
|
|
18
|
+
"serp-api",
|
|
19
|
+
"web-search",
|
|
20
|
+
"news-search",
|
|
21
|
+
"maps",
|
|
22
|
+
"shopping",
|
|
23
|
+
"web-scraping",
|
|
24
|
+
"crawler",
|
|
25
|
+
"ai-answers",
|
|
26
|
+
"email-verification",
|
|
27
|
+
"langchain",
|
|
28
|
+
"ai-agents",
|
|
29
|
+
"llm",
|
|
30
|
+
"mcp",
|
|
31
|
+
]
|
|
32
|
+
classifiers = [
|
|
33
|
+
"Development Status :: 4 - Beta",
|
|
34
|
+
"Intended Audience :: Developers",
|
|
35
|
+
"Operating System :: OS Independent",
|
|
36
|
+
"Programming Language :: Python :: 3",
|
|
37
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
38
|
+
"Programming Language :: Python :: 3.9",
|
|
39
|
+
"Programming Language :: Python :: 3.10",
|
|
40
|
+
"Programming Language :: Python :: 3.11",
|
|
41
|
+
"Programming Language :: Python :: 3.12",
|
|
42
|
+
"Programming Language :: Python :: 3.13",
|
|
43
|
+
"Programming Language :: Python :: 3.14",
|
|
44
|
+
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
|
|
45
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
46
|
+
"Typing :: Typed",
|
|
47
|
+
]
|
|
48
|
+
dependencies = ["requests>=2.28"]
|
|
49
|
+
|
|
50
|
+
[project.optional-dependencies]
|
|
51
|
+
langchain = ["langchain-core>=0.1.0"]
|
|
52
|
+
dev = ["pytest>=7.0", "responses>=0.23"]
|
|
53
|
+
|
|
54
|
+
[project.urls]
|
|
55
|
+
Homepage = "https://searlo.tech"
|
|
56
|
+
Documentation = "https://searlo.tech/docs"
|
|
57
|
+
Source = "https://github.com/eCodeVoyager/searlo-python"
|
|
58
|
+
Issues = "https://github.com/eCodeVoyager/searlo-python/issues"
|
|
59
|
+
Changelog = "https://github.com/eCodeVoyager/searlo-python/blob/main/CHANGELOG.md"
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.dynamic]
|
|
62
|
+
version = { attr = "searlo.__version__" }
|
|
63
|
+
|
|
64
|
+
[tool.setuptools.packages.find]
|
|
65
|
+
include = ["searlo*"]
|
|
66
|
+
|
|
67
|
+
[tool.setuptools.package-data]
|
|
68
|
+
searlo = ["py.typed"]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .client import Searlo
|
|
2
|
+
from .exceptions import (
|
|
3
|
+
SearloAPIError,
|
|
4
|
+
SearloAuthError,
|
|
5
|
+
SearloError,
|
|
6
|
+
SearloInsufficientCreditsError,
|
|
7
|
+
SearloRateLimitError,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__version__ = "0.2.0"
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"Searlo",
|
|
14
|
+
"SearloError",
|
|
15
|
+
"SearloAPIError",
|
|
16
|
+
"SearloAuthError",
|
|
17
|
+
"SearloInsufficientCreditsError",
|
|
18
|
+
"SearloRateLimitError",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def __getattr__(name):
|
|
23
|
+
# Lazy-load SearloSearchTool so `import searlo` never requires langchain.
|
|
24
|
+
if name == "SearloSearchTool":
|
|
25
|
+
from .langchain_tool import SearloSearchTool
|
|
26
|
+
|
|
27
|
+
return SearloSearchTool
|
|
28
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|