automdev 0.1.0__py3-none-any.whl
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.
- autom/__init__.py +61 -0
- autom/_endpoints.py +200 -0
- autom/_operations.py +2058 -0
- autom/_response.py +82 -0
- autom/_serialization.py +105 -0
- autom/_version.py +1 -0
- autom/client.py +529 -0
- autom/errors.py +85 -0
- autom/models.py +81 -0
- autom/py.typed +1 -0
- automdev-0.1.0.dist-info/METADATA +218 -0
- automdev-0.1.0.dist-info/RECORD +14 -0
- automdev-0.1.0.dist-info/WHEEL +4 -0
- automdev-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: automdev
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the Autom SERP API.
|
|
5
|
+
Project-URL: Homepage, https://www.autom.dev
|
|
6
|
+
Project-URL: Documentation, https://docs.autom.dev
|
|
7
|
+
Project-URL: Repository, https://github.com/automdev/autom-python
|
|
8
|
+
Project-URL: Issues, https://github.com/automdev/autom-python/issues
|
|
9
|
+
Author-email: Autom <contact@autom.dev>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,autom,google-search-api,sdk,search-api,seo,serp-api
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: httpx<1,>=0.27
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: build<2,>=1.2; extra == 'dev'
|
|
26
|
+
Requires-Dist: mypy>=1.13; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8.3; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff<1,>=0.8; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# Autom Python SDK
|
|
33
|
+
|
|
34
|
+
The official Python SDK for the [Autom](https://www.autom.dev) SERP API.
|
|
35
|
+
|
|
36
|
+
Google, Bing and Brave search results as structured JSON — web, maps, news, shopping, images, jobs and AI Mode.
|
|
37
|
+
|
|
38
|
+
The SDK exposes **23 typed methods**, one per documented endpoint, with blocking and `asyncio` clients built on [HTTPX](https://www.python-httpx.org/), plus a generic `request()`.
|
|
39
|
+
|
|
40
|
+
## Requirements
|
|
41
|
+
|
|
42
|
+
- Python 3.11 or newer
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pip install automdev
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Get your API key
|
|
51
|
+
|
|
52
|
+
[Sign up for Autom](https://app.autom.dev/register) or sign in, then copy your API key from the [dashboard](https://app.autom.dev). The client reads the `AUTOM_API_KEY` environment variable when no key is passed.
|
|
53
|
+
|
|
54
|
+
## Quick start
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import os
|
|
58
|
+
|
|
59
|
+
from autom import AutomClient
|
|
60
|
+
|
|
61
|
+
with AutomClient(os.environ["AUTOM_API_KEY"]) as client:
|
|
62
|
+
response = client.google_search(query="web scraping api")
|
|
63
|
+
print(response.data)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Keyword arguments mirror the [API reference](https://docs.autom.dev). Python keywords get a trailing underscore (`from_=`), and the wire name is used on the request.
|
|
67
|
+
|
|
68
|
+
## Async jobs
|
|
69
|
+
|
|
70
|
+
Any call accepts `is_async: true` (useful past the 60-second server limit): the response is then a `job_id`. `wait_for_job()` polls `GET /v1/jobs/{id}` until the job reaches a terminal status (`CompletedJob`, `Error`, `NotFound`, `BadRequest`):
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
submitted = client.google_search(query="web scraping api", is_async=True)
|
|
74
|
+
job = client.wait_for_job(
|
|
75
|
+
submitted.data["job_id"],
|
|
76
|
+
on_progress=lambda j: print(j["status"], j.get("progress")),
|
|
77
|
+
)
|
|
78
|
+
print(job.data)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Async I/O
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import asyncio
|
|
85
|
+
|
|
86
|
+
from autom import AsyncAutomClient
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
async def main() -> None:
|
|
90
|
+
async with AsyncAutomClient() as client:
|
|
91
|
+
response = await client.google_search(query="web scraping api")
|
|
92
|
+
print(response.data)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
asyncio.run(main())
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## GET or POST
|
|
99
|
+
|
|
100
|
+
Methods use GET when the endpoint supports it (parameters in the query string). POST sends the same parameters as a JSON body:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from autom import RequestOptions
|
|
104
|
+
|
|
105
|
+
client.bing_search(query="test", request_options=RequestOptions(method="POST"))
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`None` values are omitted, `False` and `0` are sent, and sequences repeat the parameter name.
|
|
109
|
+
|
|
110
|
+
## Any endpoint
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
response = client.request("GET", "/v1/usage")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Errors
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from autom import AutomAPIError
|
|
120
|
+
|
|
121
|
+
try:
|
|
122
|
+
client.google_search(query="web scraping api")
|
|
123
|
+
except AutomAPIError as error:
|
|
124
|
+
print(error.status, error, error.response_body)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
| Error | When |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `AutomConfigurationError` | Missing API key, invalid options, unsupported method, closed client. |
|
|
130
|
+
| `AutomSerializationError` | A required parameter is missing or a value can't be sent. |
|
|
131
|
+
| `AutomTransportError` | Network failure or timeout. |
|
|
132
|
+
| `AutomAPIError` | Non-2xx status (`status`, `error_message`, `response_body`, `raw_response`). |
|
|
133
|
+
| `AutomResponseDecodingError` | A success response could not be decoded. |
|
|
134
|
+
|
|
135
|
+
All of them extend `AutomError`.
|
|
136
|
+
|
|
137
|
+
## Retries
|
|
138
|
+
|
|
139
|
+
Requests are retried up to 3 times after a network error, a `408`, `500`, `502`, `503` or `504`, or a rate limit — which the API returns as `401` (or `429`) with a `Rate limit exceeded` message. Per-key quota errors (`…: quota daily`) are not retried, nor are `400`, `402`, `404` or client-side timeouts. The delay starts at 1 second and grows 1.5× per retry (capped at 30 seconds); a `Retry-After` header wins.
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
client = AutomClient(max_retries=5, retry_delay=0.5)
|
|
143
|
+
|
|
144
|
+
# or for one request
|
|
145
|
+
client.google_search(query="web scraping api", request_options=RequestOptions(max_retries=0))
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Batch requests
|
|
149
|
+
|
|
150
|
+
`batch()` runs a function per item on 10 threads (`concurrency`) and returns one `BatchResult` per item, in input order. A failing item never stops the others. `AsyncAutomClient.batch()` does the same with `asyncio`.
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
inputs = ["web scraping api", "serp api", "rank tracker"]
|
|
154
|
+
results = client.batch(inputs, lambda query: client.google_search(query=query), concurrency=5)
|
|
155
|
+
|
|
156
|
+
for result in results:
|
|
157
|
+
if result.ok:
|
|
158
|
+
print(result.value.data)
|
|
159
|
+
else:
|
|
160
|
+
print(inputs[result.index], result.error)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
| Constant | Default | Description |
|
|
164
|
+
| --- | --- | --- |
|
|
165
|
+
| `DEFAULT_CONCURRENCY` | `10` | Tasks run at the same time by batch |
|
|
166
|
+
| `DEFAULT_TIMEOUT` | `120.0` | Request timeout (seconds) |
|
|
167
|
+
| `MAX_RETRIES` | `3` | Retry attempts after a network error, a 408/5xx or a rate limit |
|
|
168
|
+
| `RETRY_BACKOFF_FACTOR` | `1.5` | Exponential backoff multiplier |
|
|
169
|
+
| `DEFAULT_RETRY_DELAY` | `1.0` | Delay before the first retry (seconds) |
|
|
170
|
+
|
|
171
|
+
## Timeouts and custom HTTPX clients
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
import httpx
|
|
175
|
+
|
|
176
|
+
from autom import AutomClient, RequestOptions
|
|
177
|
+
|
|
178
|
+
client = AutomClient(timeout=60) # seconds, default 120, None disables
|
|
179
|
+
client.google_search(query="web scraping api", request_options=RequestOptions(timeout=30))
|
|
180
|
+
|
|
181
|
+
# Bring your own HTTPX client (proxies, limits, event hooks…). You keep ownership of it.
|
|
182
|
+
http_client = httpx.Client(proxy="http://localhost:8080")
|
|
183
|
+
client = AutomClient(http_client=http_client)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Endpoints
|
|
187
|
+
|
|
188
|
+
23 methods, generated from the [OpenAPI document](https://app.autom.dev/openapi).
|
|
189
|
+
|
|
190
|
+
| Method | HTTP | Description |
|
|
191
|
+
| --- | --- | --- |
|
|
192
|
+
| `bing_search()` | GET / POST `/v1/bing/search` | Query Bing Search via API and retrieve structured organic results (title, link, snippet, position). |
|
|
193
|
+
| `brave_images()` | GET / POST `/v1/brave/images` | Search Brave Images via API and retrieve structured image results with pagination and SafeSearch. |
|
|
194
|
+
| `brave_search()` | GET / POST `/v1/brave/search` | Search Brave Search via API and retrieve structured organic results with pagination. |
|
|
195
|
+
| `brave_videos()` | GET / POST `/v1/brave/videos` | Search Brave Videos via API and retrieve structured video results with pagination and SafeSearch. |
|
|
196
|
+
| `duckduckgo_search()` | GET / POST `/v1/duckduckgo/search` | Query DuckDuckGo via API and retrieve structured organic results with region and language. |
|
|
197
|
+
| `finder_google_countries()` | GET `/v1/finder/google-countries` | Search Google countries and retrieve country codes (free Finder endpoint). |
|
|
198
|
+
| `finder_google_languages()` | GET `/v1/finder/google-languages` | Search Google languages and retrieve language codes (free Finder endpoint). |
|
|
199
|
+
| `finder_google_locations()` | GET `/v1/finder/google-locations` | Find supported Google locations and retrieve location IDs and country codes (free endpoint). |
|
|
200
|
+
| `google_images()` | GET / POST `/v1/google/images` | Search Google Images via API and retrieve image results (URLs, titles, sources, dimensions). |
|
|
201
|
+
| `google_jobs()` | GET / POST `/v1/google/jobs` | Scrape Google Jobs results via API and retrieve structured job listings with title, company, location, and pagination. |
|
|
202
|
+
| `google_maps()` | GET / POST `/v1/google/maps` | Search Google Maps via API and retrieve structured place results (address, website, phone). |
|
|
203
|
+
| `google_news()` | GET / POST `/v1/google/news` | Search Google News via API and retrieve structured news results with pagination. |
|
|
204
|
+
| `google_search()` | GET / POST `/v1/google/search` | Scrape Google Search results via API and retrieve structured SERP data with pagination. |
|
|
205
|
+
| `google_search_ai()` | GET / POST `/v1/google/search/ai` | Query Google AI Mode via API. JSON with text_blocks, references, and shopping_results. |
|
|
206
|
+
| `google_search_autocomplete()` | GET / POST `/v1/google/search/autocomplete` | Get Google Search autocomplete suggestions via API for a given query. |
|
|
207
|
+
| `google_search_light()` | GET / POST `/v1/google/search/light` | Scrape lightweight Google Search results via API: fast, cost-efficient, organic results only. |
|
|
208
|
+
| `google_shopping()` | GET / POST `/v1/google/shopping` | Scrape Google Shopping results via API and retrieve structured product listings with prices, ratings, and merchant data. |
|
|
209
|
+
| `google_videos()` | GET / POST `/v1/google/videos` | Search Google Videos via API and retrieve structured video results with metadata. |
|
|
210
|
+
| `jobs()` | GET `/v1/jobs/{id}` | Poll the status, progress (0–100) and result of a job started with is_async=true. Polling is free. Poll until status is terminal: Completed… |
|
|
211
|
+
| `search()` | GET / POST `/v1/search` | One call walks engines in order and returns the first organic results. engines=auto tries Google, then Brave, Bing, DuckDuckGo, Yahoo, and… |
|
|
212
|
+
| `stats()` | GET `/v1/stats` | Infrastructure health for an engine or endpoint over the last hour. Not scoped to your account or tenant. Enabled per account: HTTP 403 mea… |
|
|
213
|
+
| `usage()` | GET `/v1/usage` | Retrieve real-time usage statistics and credit balance for your Autom account. |
|
|
214
|
+
| `yahoo_search()` | GET / POST `/v1/yahoo/search` | Query Yahoo via API and retrieve structured organic results with country and language. |
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
autom/__init__.py,sha256=mkvELSHwyM1LAEEmmbtQuEwJ-EiiZhetYs9oSTZGIvg,1283
|
|
2
|
+
autom/_endpoints.py,sha256=huTolPF-xPr4OSzJPgzRfS89e4ReistxTuS3PsqTlkU,4690
|
|
3
|
+
autom/_operations.py,sha256=4oMIEvMqcvh3Wv0T728VkaucH-syzhfurjNplLmQf9U,96179
|
|
4
|
+
autom/_response.py,sha256=R2FxO3NWkxjksW17poZIgThlYEfBKKd7lew5yNbQ7us,2876
|
|
5
|
+
autom/_serialization.py,sha256=K5SB25M2lDlDfobOayOEiaG5u2AIop_UuftODCflRRo,3912
|
|
6
|
+
autom/_version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
7
|
+
autom/client.py,sha256=cN_slKwPImZbXFUecuTsVBWof-HDJkbErrff-W8kfnU,20013
|
|
8
|
+
autom/errors.py,sha256=2K-s6kgxl5PQ6wdbnIhcsJmfp2e-Ad89wdPg7DGOLmA,2357
|
|
9
|
+
autom/models.py,sha256=LjFfAcV69ADZPcbktHfZGfOe-vHZZ0KauCL_8q62daw,2305
|
|
10
|
+
autom/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
11
|
+
automdev-0.1.0.dist-info/METADATA,sha256=9QZ7ciwGM1nb6ctQvdS73Pu_7G-QLbUgbP_e7dvLuqU,10031
|
|
12
|
+
automdev-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
13
|
+
automdev-0.1.0.dist-info/licenses/LICENSE,sha256=E_6SaIT0VI8NByEWFN7sDAMA0UHEG7_bGKzjcz_fh40,1062
|
|
14
|
+
automdev-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Autom
|
|
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.
|