decodo-sdk 2.2.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.
- decodo/__init__.py +292 -0
- decodo/api/__init__.py +3 -0
- decodo/api/web_scraping_api.py +74 -0
- decodo/client.py +58 -0
- decodo/codegen/__init__.py +0 -0
- decodo/codegen/codegen.py +71 -0
- decodo/codegen/web_scraping_api/__init__.py +0 -0
- decodo/codegen/web_scraping_api/generate_parameters.py +124 -0
- decodo/codegen/web_scraping_api/generate_targets.py +223 -0
- decodo/codegen/web_scraping_api/shared.py +65 -0
- decodo/codegen/web_scraping_api/types.py +26 -0
- decodo/errors.py +36 -0
- decodo/generated/__init__.py +0 -0
- decodo/generated/decodo.ir.json +2775 -0
- decodo/generated/parameters.py +93 -0
- decodo/generated/targets.py +1585 -0
- decodo/http.py +111 -0
- decodo/py.typed +0 -0
- decodo/schema/__init__.py +25 -0
- decodo/schema/build_target_meta.py +23 -0
- decodo/schema/bundled_schema.py +97 -0
- decodo/schema/constants.py +5 -0
- decodo/schema/expand_path.py +12 -0
- decodo/schema/remote_schema.py +136 -0
- decodo/schema/resolve_latest_ir.py +69 -0
- decodo/schema/types.py +65 -0
- decodo/targets.py +63 -0
- decodo/types/__init__.py +27 -0
- decodo/types/requests.py +7 -0
- decodo/types/responses.py +71 -0
- decodo_sdk-2.2.0.dist-info/METADATA +459 -0
- decodo_sdk-2.2.0.dist-info/RECORD +35 -0
- decodo_sdk-2.2.0.dist-info/WHEEL +5 -0
- decodo_sdk-2.2.0.dist-info/licenses/LICENSE +21 -0
- decodo_sdk-2.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, TypedDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ResultEntry(TypedDict, total=False):
|
|
7
|
+
content: Any
|
|
8
|
+
status_code: int
|
|
9
|
+
url: str
|
|
10
|
+
task_id: str
|
|
11
|
+
headers: dict[str, str]
|
|
12
|
+
cookies: list[dict[str, str]]
|
|
13
|
+
created_at: str
|
|
14
|
+
updated_at: str
|
|
15
|
+
help: str
|
|
16
|
+
browser_actions_warnings: list[dict[str, str]]
|
|
17
|
+
browser_actions_error: list[dict[str, str]]
|
|
18
|
+
delivery_zip: str
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SyncResponse(TypedDict):
|
|
22
|
+
results: list[ResultEntry]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AsyncTaskResponse(TypedDict, total=False):
|
|
26
|
+
id: str
|
|
27
|
+
target: str
|
|
28
|
+
url: str
|
|
29
|
+
query: str
|
|
30
|
+
status: str
|
|
31
|
+
created_at: str
|
|
32
|
+
updated_at: str
|
|
33
|
+
page_from: int
|
|
34
|
+
limit: int
|
|
35
|
+
geo: str | None
|
|
36
|
+
device_type: str
|
|
37
|
+
headless: str | None
|
|
38
|
+
parse: bool
|
|
39
|
+
locale: str | None
|
|
40
|
+
domain: str
|
|
41
|
+
output_schema: str | None
|
|
42
|
+
content_encoding: str
|
|
43
|
+
page_count: int
|
|
44
|
+
adults: int
|
|
45
|
+
children: int
|
|
46
|
+
callback_url: str
|
|
47
|
+
browser_actions_error: list[dict[str, str]]
|
|
48
|
+
browser_actions_warnings: list[dict[str, str]]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class BatchResponse(TypedDict, total=False):
|
|
52
|
+
id: str
|
|
53
|
+
queries: list[AsyncTaskResponse]
|
|
54
|
+
errors: list[dict[str, str]]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
TaskStatus = Literal["pending", "faulted", "done"]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class TaskMetadata(TypedDict, total=False):
|
|
61
|
+
status: TaskStatus
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class TaskResultsResponse(TypedDict):
|
|
65
|
+
results: list[ResultEntry]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ErrorResponse(TypedDict, total=False):
|
|
69
|
+
status: str
|
|
70
|
+
message: str
|
|
71
|
+
errors: list[Any]
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: decodo-sdk
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: Official Python SDK for the Decodo APIs
|
|
5
|
+
Author: Decodo
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Decodo
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Decodo/sdk-python
|
|
29
|
+
Project-URL: Documentation, https://help.decodo.com/docs/introduction
|
|
30
|
+
Project-URL: Repository, https://github.com/Decodo/sdk-python
|
|
31
|
+
Keywords: decodo,scraping,web-scraping,api
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
37
|
+
Requires-Python: >=3.12
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
License-File: LICENSE
|
|
40
|
+
Requires-Dist: httpx>=0.27.0
|
|
41
|
+
Requires-Dist: pydantic>=2.0
|
|
42
|
+
Requires-Dist: jsonschema>=4.0
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
|
|
46
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
47
|
+
Requires-Dist: mypy>=1.10.0; extra == "dev"
|
|
48
|
+
Requires-Dist: types-jsonschema>=4.0; extra == "dev"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# Decodo Python SDK
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
[](https://discord.gg/Ja8dqKgvbZ)
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<a href="https://dashboard.decodo.com/integrations?utm_source=github&utm_medium=social&utm_campaign=mcp_server"> <img src="https://github.com/user-attachments/assets/a1e52a9e-3da1-4081-b3c6-053aafb8f196"/></a>
|
|
60
|
+
|
|
61
|
+
The official Python SDK for the Decodo Web Scraping API.
|
|
62
|
+
|
|
63
|
+
Build scraping workflows for search engines, eCommerce platforms, social media, AI tools, and more using the Decodo Web Scraping API.
|
|
64
|
+
|
|
65
|
+
- Fully typed targets and parameters with IDE autocomplete
|
|
66
|
+
- Sync, async, and batch scraping methods
|
|
67
|
+
- Built on `httpx`, Python 3.12+
|
|
68
|
+
- Typed error hierarchy for safer integrations
|
|
69
|
+
- Built for Python and modern tooling
|
|
70
|
+
|
|
71
|
+
# What is Decodo Python SDK?
|
|
72
|
+
|
|
73
|
+
Decodo Python SDK is the official Python SDK for the Decodo Web Scraping API. It provides a typed interface for interacting with Decodo targets like Google, Amazon, TikTok, Reddit, YouTube, ChatGPT, Perplexity, and more.
|
|
74
|
+
|
|
75
|
+
Instead of manually constructing HTTP requests and validating payloads, you can work with fully typed methods and target-specific parameters directly in your editor.
|
|
76
|
+
|
|
77
|
+
# Why use the SDK?
|
|
78
|
+
|
|
79
|
+
- **Typing and autocomplete**. Target parameters are fully typed for better DX and fewer mistakes.
|
|
80
|
+
- **Unified scraping interface**. Work with search engines, eCommerce platforms, social media, and AI tools through one SDK.
|
|
81
|
+
- **Async and batch workflows**. Create scraping tasks, poll statuses, and process batches at scale.
|
|
82
|
+
- **Typed errors**. Handle authentication, validation, timeout, and rate-limit failures safely.
|
|
83
|
+
- **Minimal setup**. Single dependency on `httpx`, no additional HTTP client required.
|
|
84
|
+
|
|
85
|
+
## Requirements
|
|
86
|
+
|
|
87
|
+
- Python 3.12+
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install decodo-sdk
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Quick start
|
|
96
|
+
|
|
97
|
+
Create a new project:
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
mkdir scrape-with-decodo
|
|
101
|
+
cd scrape-with-decodo
|
|
102
|
+
|
|
103
|
+
pip install decodo-sdk
|
|
104
|
+
|
|
105
|
+
touch main.py
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Get your Web Scraping API token from the [Decodo dashboard](https://dashboard.decodo.com/welcome). The token is the base64-encoded `user:password` value from the Basic Auth credentials shown in the dashboard.
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
# main.py
|
|
112
|
+
from decodo import DecodoClient, DecodoConfig, WebScrapingApiConfig
|
|
113
|
+
|
|
114
|
+
client = DecodoClient(
|
|
115
|
+
DecodoConfig(
|
|
116
|
+
web_scraping_api=WebScrapingApiConfig(token="<basic_auth_token>"),
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
result = client.web_scraping_api.scrape({
|
|
121
|
+
"target": "google_search",
|
|
122
|
+
"query": "coffee shops",
|
|
123
|
+
"geo": "United States",
|
|
124
|
+
"parse": True,
|
|
125
|
+
})
|
|
126
|
+
print(result)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Run the script:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
python main.py
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### With typed parameters (recommended)
|
|
136
|
+
|
|
137
|
+
Typed parameter classes are included in the package — no extra steps needed after `pip install decodo-sdk`:
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from decodo import DecodoClient, DecodoConfig, GoogleSearchParams, Target, WebScrapingApiConfig
|
|
141
|
+
|
|
142
|
+
client = DecodoClient(
|
|
143
|
+
DecodoConfig(
|
|
144
|
+
web_scraping_api=WebScrapingApiConfig(token="<basic_auth_token>"),
|
|
145
|
+
)
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
result = client.web_scraping_api.scrape(
|
|
149
|
+
GoogleSearchParams(
|
|
150
|
+
target=Target.GoogleSearch,
|
|
151
|
+
query="coffee shops",
|
|
152
|
+
geo="United States",
|
|
153
|
+
parse=True,
|
|
154
|
+
)
|
|
155
|
+
)
|
|
156
|
+
print(result)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Updating types to a newer schema
|
|
160
|
+
|
|
161
|
+
The types bundled in the package reflect the schema at release time. To update them to the latest schema without waiting for a new release, run the type generator:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
python -m decodo.codegen.codegen --out-dir ./decodo_generated
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Then import from that directory instead:
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from decodo_generated.targets import GoogleSearchParams
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
> The directory name passed to `--out-dir` becomes the import namespace. `./decodo_generated` → `from decodo_generated.targets import ...`. You can use any name, but keep it consistent across your project.
|
|
174
|
+
|
|
175
|
+
<details>
|
|
176
|
+
<summary>Example response</summary>
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"results": [
|
|
181
|
+
{
|
|
182
|
+
"content": {
|
|
183
|
+
"results": {
|
|
184
|
+
"last_visible_page": 10,
|
|
185
|
+
"page": 1,
|
|
186
|
+
"parse_status_code": 12000,
|
|
187
|
+
"results": {
|
|
188
|
+
"local_pack": [
|
|
189
|
+
{
|
|
190
|
+
"items": [
|
|
191
|
+
{
|
|
192
|
+
"address": "Rochester, NY",
|
|
193
|
+
"paid": false,
|
|
194
|
+
"pos": 1,
|
|
195
|
+
"rating": 4.9,
|
|
196
|
+
"rating_count": 1700,
|
|
197
|
+
"subtitle": "Coffee shop",
|
|
198
|
+
"title": "Albunn Coffee House"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"address": "Rochester, NY",
|
|
202
|
+
"paid": false,
|
|
203
|
+
"pos": 2,
|
|
204
|
+
"rating": 4.8,
|
|
205
|
+
"rating_count": 937,
|
|
206
|
+
"subtitle": "Coffee shop",
|
|
207
|
+
"title": "Layali Coffee House"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"address": "Ocean Township, NJ",
|
|
211
|
+
"paid": false,
|
|
212
|
+
"pos": 3,
|
|
213
|
+
"rating": 4.9,
|
|
214
|
+
"rating_count": 124,
|
|
215
|
+
"subtitle": "Coffee shop",
|
|
216
|
+
"title": "Ocean Brew Co."
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"pos_overall": 1
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"organic": [
|
|
223
|
+
{
|
|
224
|
+
"desc": "For an alternate, local view, Eater has an interesting list of what it considers Philadelphia's 21 Essential Coffee Shops.",
|
|
225
|
+
"pos": 1,
|
|
226
|
+
"pos_overall": 2,
|
|
227
|
+
"title": "Philadelphia",
|
|
228
|
+
"url": "https://www.brian-coffee-spot.com/the-coffee-spot-guide-to/usa-canada/philadelphia/"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"search_information": {
|
|
232
|
+
"query": "coffee shops",
|
|
233
|
+
"total_results_count": 403000000
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"url": "https://www.google.com/search?q=coffee+shops&hl=en&gl=us"
|
|
237
|
+
},
|
|
238
|
+
"errors": [],
|
|
239
|
+
"status_code": 12000,
|
|
240
|
+
"task_id": "7463508496927950850"
|
|
241
|
+
},
|
|
242
|
+
"status_code": 200,
|
|
243
|
+
"url": "https://www.google.com/search?q=coffee+shops&hl=en&gl=us",
|
|
244
|
+
"task_id": "7463508496927950850",
|
|
245
|
+
"created_at": "2026-05-22 08:38:10",
|
|
246
|
+
"updated_at": "2026-05-22 08:38:13"
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
</details>
|
|
253
|
+
|
|
254
|
+
## Configuration
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
from decodo import DecodoClient, DecodoConfig, WebScrapingApiConfig
|
|
258
|
+
|
|
259
|
+
client = DecodoClient(
|
|
260
|
+
DecodoConfig(
|
|
261
|
+
web_scraping_api=WebScrapingApiConfig(token="<basic_auth_token>"),
|
|
262
|
+
timeout_ms=120_000, # optional, request timeout in ms (default: 180000)
|
|
263
|
+
)
|
|
264
|
+
)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
| Parameter | Description |
|
|
268
|
+
| --- | --- |
|
|
269
|
+
| `token` | Web Scraping API basic auth token - the base64-encoded `user:password` string from the Decodo dashboard |
|
|
270
|
+
| `timeout_ms` | Request timeout in milliseconds (default: 180000) |
|
|
271
|
+
|
|
272
|
+
## Web Scraping API
|
|
273
|
+
|
|
274
|
+
Access the API via `client.web_scraping_api`.
|
|
275
|
+
|
|
276
|
+
The snippets below assume you have already constructed a client. See [Configuration](#configuration) for how to build one.
|
|
277
|
+
|
|
278
|
+
### Sync scrape
|
|
279
|
+
|
|
280
|
+
Waits for the scraping result before returning:
|
|
281
|
+
|
|
282
|
+
```python
|
|
283
|
+
result = client.web_scraping_api.scrape({
|
|
284
|
+
"target": "amazon_product",
|
|
285
|
+
"query": "B09H74FXNW",
|
|
286
|
+
"parse": True,
|
|
287
|
+
})
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Async scrape
|
|
291
|
+
|
|
292
|
+
Creates a scraping task and returns immediately. Poll separately for task status and results:
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
task = client.web_scraping_api.scrape_async({
|
|
296
|
+
"target": "google_search",
|
|
297
|
+
"query": "laptop reviews",
|
|
298
|
+
"parse": True,
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
meta = client.web_scraping_api.get_status(task["id"])
|
|
302
|
+
print(meta["status"]) # 'pending' | 'done' | 'faulted'
|
|
303
|
+
|
|
304
|
+
results = client.web_scraping_api.get_results(task["id"])
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Batch scrape
|
|
308
|
+
|
|
309
|
+
Send multiple queries or URLs in a single request:
|
|
310
|
+
|
|
311
|
+
```python
|
|
312
|
+
batch = client.web_scraping_api.scrape_batch({
|
|
313
|
+
"target": "google_search",
|
|
314
|
+
"query": ["coffee", "tea", "juice"],
|
|
315
|
+
"parse": True,
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
coffee_task_id = batch["queries"][0]["id"]
|
|
319
|
+
|
|
320
|
+
client.web_scraping_api.get_results(coffee_task_id)
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Supported targets
|
|
324
|
+
|
|
325
|
+
Each target accepts one primary input parameter (`url`, `query`, `product_id`, or `prompt`) together with optional configuration. The examples below show the minimum payload to call `client.web_scraping_api.scrape(...)`.
|
|
326
|
+
|
|
327
|
+
### Search engines
|
|
328
|
+
|
|
329
|
+
| Target | Description | Example |
|
|
330
|
+
| --- | --- | --- |
|
|
331
|
+
| `Target.GoogleSearch` | Google Search results for a query | `{"target": Target.GoogleSearch, "query": "coffee shops"}` |
|
|
332
|
+
| `Target.GoogleMaps` | Google Maps search results | `{"target": Target.GoogleMaps, "query": "coffee shops brooklyn"}` |
|
|
333
|
+
| `Target.GoogleShoppingSearch` | Google Shopping search results | `{"target": Target.GoogleShoppingSearch, "query": "laptop"}` |
|
|
334
|
+
| `Target.GoogleShoppingProduct` | Google Shopping product page | `{"target": Target.GoogleShoppingProduct, "query": "B09H74FXNW"}` |
|
|
335
|
+
| `Target.GoogleSuggest` | Google Autocomplete suggestions | `{"target": Target.GoogleSuggest, "query": "coffee"}` |
|
|
336
|
+
| `Target.GoogleLens` | Google Lens reverse image search | `{"target": Target.GoogleLens, "query": "https://example.com/cat.jpg"}` |
|
|
337
|
+
| `Target.GoogleTravelHotels` | Google Travel hotel listings | `{"target": Target.GoogleTravelHotels, "query": "hotels in paris"}` |
|
|
338
|
+
| `Target.GoogleTrendsExplore` | Google Trends explore data | `{"target": Target.GoogleTrendsExplore, "query": "coffee"}` |
|
|
339
|
+
| `Target.GoogleAds` | Google Ads results for a query | `{"target": Target.GoogleAds, "query": "laptop"}` |
|
|
340
|
+
| `Target.BingSearch` | Bing Search results | `{"target": Target.BingSearch, "query": "electric vehicles"}` |
|
|
341
|
+
| `Target.Bing` | Raw Bing URL scraping | `{"target": Target.Bing, "url": "https://bing.com/search?q=laptop"}` |
|
|
342
|
+
|
|
343
|
+
### eCommerce
|
|
344
|
+
|
|
345
|
+
| Target | Description | Example |
|
|
346
|
+
| --- | --- | --- |
|
|
347
|
+
| `Target.AmazonProduct` | Amazon product detail page by ASIN | `{"target": Target.AmazonProduct, "query": "B09H74FXNW"}` |
|
|
348
|
+
| `Target.AmazonSearch` | Amazon search results | `{"target": Target.AmazonSearch, "query": "laptop"}` |
|
|
349
|
+
| `Target.AmazonPricing` | Amazon pricing and offers | `{"target": Target.AmazonPricing, "query": "B09H74FXNW"}` |
|
|
350
|
+
| `Target.AmazonSellers` | Amazon seller listings | `{"target": Target.AmazonSellers, "query": "B09H74FXNW"}` |
|
|
351
|
+
| `Target.AmazonBestsellers` | Amazon bestsellers by category | `{"target": Target.AmazonBestsellers, "query": "electronics"}` |
|
|
352
|
+
| `Target.WalmartProduct` | Walmart product page by product ID | `{"target": Target.WalmartProduct, "product_id": "15296401808"}` |
|
|
353
|
+
| `Target.WalmartSearch` | Walmart search results | `{"target": Target.WalmartSearch, "query": "laptop"}` |
|
|
354
|
+
| `Target.Walmart` | Raw Walmart URL scraping | `{"target": Target.Walmart, "url": "https://walmart.com/ip/15296401808"}` |
|
|
355
|
+
| `Target.TargetProduct` | Target.com product page by product ID | `{"target": Target.TargetProduct, "product_id": "92186007"}` |
|
|
356
|
+
| `Target.TargetSearch` | Target.com search results | `{"target": Target.TargetSearch, "query": "laptop"}` |
|
|
357
|
+
| `Target.Target` | Raw Target.com URL scraping | `{"target": Target.Target, "url": "https://target.com/p/-/A-92186007"}` |
|
|
358
|
+
| `Target.LowesSearch` | Lowe's search results | `{"target": Target.LowesSearch, "query": "drill"}` |
|
|
359
|
+
| `Target.Ecommerce` | Generic eCommerce page with parser | `{"target": Target.Ecommerce, "url": "https://example.com/product/123"}` |
|
|
360
|
+
|
|
361
|
+
### Social media
|
|
362
|
+
|
|
363
|
+
| Target | Description | Example |
|
|
364
|
+
| --- | --- | --- |
|
|
365
|
+
| `Target.RedditPost` | Reddit post by URL | `{"target": Target.RedditPost, "url": "https://reddit.com/r/nba/..."}` |
|
|
366
|
+
| `Target.RedditSubreddit` | Reddit subreddit by URL | `{"target": Target.RedditSubreddit, "url": "https://reddit.com/r/nba/"}` |
|
|
367
|
+
| `Target.RedditUser` | Reddit user profile by URL | `{"target": Target.RedditUser, "url": "https://reddit.com/user/example/"}` |
|
|
368
|
+
| `Target.YoutubeVideo` | YouTube video by ID | `{"target": Target.YoutubeVideo, "query": "dFu9aKJoqGg"}` |
|
|
369
|
+
| `Target.YoutubeSearch` | YouTube search results | `{"target": Target.YoutubeSearch, "query": "ambient music"}` |
|
|
370
|
+
| `Target.YoutubeSearchMax` | YouTube search results (extended) | `{"target": Target.YoutubeSearchMax, "query": "ambient music"}` |
|
|
371
|
+
| `Target.YoutubeMetadata` | YouTube video metadata by ID | `{"target": Target.YoutubeMetadata, "query": "dFu9aKJoqGg"}` |
|
|
372
|
+
| `Target.YoutubeTranscript` | YouTube video transcript by ID | `{"target": Target.YoutubeTranscript, "query": "dFu9aKJoqGg"}` |
|
|
373
|
+
| `Target.YoutubeSubtitles` | YouTube video subtitles by ID | `{"target": Target.YoutubeSubtitles, "query": "dFu9aKJoqGg"}` |
|
|
374
|
+
| `Target.YoutubeChannel` | YouTube channel by URL | `{"target": Target.YoutubeChannel, "url": "https://youtube.com/@mkbhd"}` |
|
|
375
|
+
| `Target.TiktokPost` | TikTok post by URL | `{"target": Target.TiktokPost, "url": "https://www.tiktok.com/@nba/video/..."}` |
|
|
376
|
+
| `Target.TiktokShopSearch` | TikTok Shop search results | `{"target": Target.TiktokShopSearch, "query": "wireless earbuds"}` |
|
|
377
|
+
| `Target.TiktokShopProduct` | TikTok Shop product page | `{"target": Target.TiktokShopProduct, "url": "https://www.tiktok.com/view/product/..."}` |
|
|
378
|
+
| `Target.Tiktok` | Raw TikTok URL scraping | `{"target": Target.Tiktok, "url": "https://www.tiktok.com/@nba"}` |
|
|
379
|
+
| `Target.InstagramGraphqlProfile` | Instagram profile via GraphQL | `{"target": Target.InstagramGraphqlProfile, "query": "nba"}` |
|
|
380
|
+
|
|
381
|
+
### AI tools
|
|
382
|
+
|
|
383
|
+
| Target | Description | Example |
|
|
384
|
+
| --- | --- | --- |
|
|
385
|
+
| `Target.Chatgpt` | ChatGPT response for a prompt | `{"target": Target.Chatgpt, "prompt": "What are the top three dog breeds?"}` |
|
|
386
|
+
| `Target.Perplexity` | Perplexity response for a prompt | `{"target": Target.Perplexity, "prompt": "What causes seasonal allergies?"}` |
|
|
387
|
+
| `Target.Gemini` | Gemini response for a prompt | `{"target": Target.Gemini, "prompt": "What are the top three dog breeds?"}` |
|
|
388
|
+
| `Target.GoogleAiMode` | Google AI Mode response | `{"target": Target.GoogleAiMode, "query": "What are the top three dog breeds?"}` |
|
|
389
|
+
|
|
390
|
+
### Other
|
|
391
|
+
|
|
392
|
+
| Target | Description | Example |
|
|
393
|
+
| --- | --- | --- |
|
|
394
|
+
| `Target.Bbb` | Better Business Bureau listing by URL | `{"target": Target.Bbb, "url": "https://bbb.org/us/ny/new-york/..."}` |
|
|
395
|
+
| `Target.Autotrader` | Autotrader listing by URL | `{"target": Target.Autotrader, "url": "https://autotrader.com/cars-for-sale/..."}` |
|
|
396
|
+
| `Target.Mobile` | Mobile.de listing by URL | `{"target": Target.Mobile, "url": "https://mobile.de/auto/..."}` |
|
|
397
|
+
| `Target.Airbnb` | Airbnb listing by URL | `{"target": Target.Airbnb, "url": "https://airbnb.com/rooms/12345"}` |
|
|
398
|
+
| `Target.AppleAppStore` | Apple App Store app by URL | `{"target": Target.AppleAppStore, "url": "https://apps.apple.com/app/id12345"}` |
|
|
399
|
+
|
|
400
|
+
### Universal scraping
|
|
401
|
+
|
|
402
|
+
| Target | Description | Example |
|
|
403
|
+
| --- | --- | --- |
|
|
404
|
+
| `Target.Universal` | Any URL via the universal scraper | `{"target": Target.Universal, "url": "https://example.com"}` |
|
|
405
|
+
| `Target.Google` | Raw Google URL scraping | `{"target": Target.Google, "url": "https://google.com/search?q=laptop"}` |
|
|
406
|
+
| `Target.Amazon` | Raw Amazon URL scraping | `{"target": Target.Amazon, "url": "https://amazon.com/dp/B09H74FXNW"}` |
|
|
407
|
+
|
|
408
|
+
> `Target.UniversalEcommerce` isn't listed above because it doesn't accept a primary input parameter like `url`, `query`, `product_id`, or `prompt`. It only accepts optional configuration fields such as `callback_url`.
|
|
409
|
+
|
|
410
|
+
For the full target list and parameter details, see the API documentation:
|
|
411
|
+
|
|
412
|
+
- [Target list](https://help.decodo.com/docs/web-scraping-api-targets)
|
|
413
|
+
- [Parameters](https://help.decodo.com/docs/web-scraping-api-parameters)
|
|
414
|
+
|
|
415
|
+
## Error handling
|
|
416
|
+
|
|
417
|
+
The SDK raises typed errors that map to API error codes:
|
|
418
|
+
|
|
419
|
+
```python
|
|
420
|
+
from decodo import (
|
|
421
|
+
AuthenticationError,
|
|
422
|
+
RateLimitError,
|
|
423
|
+
ValidationError,
|
|
424
|
+
TimeoutError,
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
try:
|
|
428
|
+
client.web_scraping_api.scrape({
|
|
429
|
+
"target": "google_search",
|
|
430
|
+
"query": "test",
|
|
431
|
+
"parse": True,
|
|
432
|
+
})
|
|
433
|
+
except AuthenticationError:
|
|
434
|
+
pass # 401/403 - bad credentials
|
|
435
|
+
except RateLimitError:
|
|
436
|
+
pass # 429 - too many requests
|
|
437
|
+
except ValidationError as err:
|
|
438
|
+
print(err.errors) # 422 - invalid parameters
|
|
439
|
+
except TimeoutError:
|
|
440
|
+
pass # request timed out
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## Related repositories
|
|
444
|
+
|
|
445
|
+
- [Web Scraping API](https://github.com/Decodo/Web-Scraping-API)
|
|
446
|
+
- [Decodo MCP Server](https://github.com/Decodo/mcp-server)
|
|
447
|
+
- [Decodo OpenClaw Skill](https://github.com/Decodo/decodo-openclaw-skill)
|
|
448
|
+
|
|
449
|
+
## Get started
|
|
450
|
+
|
|
451
|
+
Build scraping workflows with the Decodo Web Scraping API:
|
|
452
|
+
|
|
453
|
+
- [Start free plan](https://dashboard.decodo.com/)
|
|
454
|
+
- [Documentation](https://help.decodo.com/docs/introduction)
|
|
455
|
+
- [Discord](https://discord.gg/Ja8dqKgvbZ)
|
|
456
|
+
|
|
457
|
+
## License
|
|
458
|
+
|
|
459
|
+
Released under the [MIT License](https://github.com/Decodo/Decodo/blob/master/LICENSE).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
decodo/__init__.py,sha256=yBCeCRdDNXXfyj6ySco3enxYZiblnjCjdznbjrj77nQ,8694
|
|
2
|
+
decodo/client.py,sha256=eR-qEb2UV8Si9LuvsOBKslO93O2rO5DuQEOrHLSYC7Y,1799
|
|
3
|
+
decodo/errors.py,sha256=3uDpbLz_zTP0Vn3eTNGAiz3XqOEQSszKc9d6swowBVY,1084
|
|
4
|
+
decodo/http.py,sha256=3PlWSBZ4EgujNOt33wq-n4YLE_K2F2DtwJEMbZHcpIU,3184
|
|
5
|
+
decodo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
decodo/targets.py,sha256=0QuIn7qZCCH2ZBa29KqJswDPAXmuJRawxrz_3AXeVoE,2074
|
|
7
|
+
decodo/api/__init__.py,sha256=R-weqBYpEPQ-wJEg5sus-4L0C_1tI0hV3NMchQta2AA,75
|
|
8
|
+
decodo/api/web_scraping_api.py,sha256=kRsc-n3VsG_5Z465Z1wiAa-otBzrIw9yZwXzcJb_qEA,2811
|
|
9
|
+
decodo/codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
decodo/codegen/codegen.py,sha256=FvEoAK7e3f3uJo52djDyC4xJ6h9s_nKextKeu7xj9pE,2448
|
|
11
|
+
decodo/codegen/web_scraping_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
decodo/codegen/web_scraping_api/generate_parameters.py,sha256=3FlHeHbRAOxlSyqYN88itdXpeZTAeSV5s193j-UT8fU,4236
|
|
13
|
+
decodo/codegen/web_scraping_api/generate_targets.py,sha256=qUZtE1H1KRZNCx4PQagvnW_8rXXNmQsSQW5Mk73mUWY,8437
|
|
14
|
+
decodo/codegen/web_scraping_api/shared.py,sha256=nQ7AyV_DhPWB5VjpdLHHcEAW4aeFuRa5ieXMAbjYwjo,1998
|
|
15
|
+
decodo/codegen/web_scraping_api/types.py,sha256=XsMMowjjv1Uye-DPGKg5nLV17FeZRUVDcCXqFQp-thw,465
|
|
16
|
+
decodo/generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
decodo/generated/decodo.ir.json,sha256=5HyKeKgch4oYTdeoOB4Y5Aue1HOqgSQlVSxOXQ2cIrc,72437
|
|
18
|
+
decodo/generated/parameters.py,sha256=nan64nmIQQAw-py04aq3TFyPR3tCkX1eR6FIWyph60U,4267
|
|
19
|
+
decodo/generated/targets.py,sha256=mHnSgmSqpn1qggZBPIXb08uuxnIDVfB8RPCV-zOKHmE,65359
|
|
20
|
+
decodo/schema/__init__.py,sha256=T1r3LWzaqiPTg7xncqQxTwyMHFDT-D_BHOt9yPS6w3M,469
|
|
21
|
+
decodo/schema/build_target_meta.py,sha256=LauRVvSt7XpPAmsgM8IDoFt_FXIN5iSihCWxvngP9hs,711
|
|
22
|
+
decodo/schema/bundled_schema.py,sha256=03j5ViERHwPsEXUDIw87S32rgWZnXnENx0qgESXrp9s,2916
|
|
23
|
+
decodo/schema/constants.py,sha256=_MiJeuERJAKcU2B88SemebKA3CDD_iQd5RwQzTFK-3A,301
|
|
24
|
+
decodo/schema/expand_path.py,sha256=MjSVi7HHT0d_13pWFnQ4D2YSLHbkN0s4tdgZIZJKWkE,266
|
|
25
|
+
decodo/schema/remote_schema.py,sha256=p8SozwVWzdhVA6GSaWifCRlOegS9xrfPV1m7SCutQrY,4236
|
|
26
|
+
decodo/schema/resolve_latest_ir.py,sha256=6PqHP3MHA61ZnjOj-kRTTdPPGdibhNwavcBrzLtX5Lk,1965
|
|
27
|
+
decodo/schema/types.py,sha256=FHQAleY1R-QAhU-1dqSl5Z2LpHN_nfG5PlaMFmGPnhQ,1340
|
|
28
|
+
decodo/types/__init__.py,sha256=tho50jT2D9grNKSVK9Ka1ejcH3O_05xOHsiL9NQqKGo,497
|
|
29
|
+
decodo/types/requests.py,sha256=umUsFgrhzKwEGVCtcKdPBbsU2Ia3QuYk9NVEZK7TiIw,195
|
|
30
|
+
decodo/types/responses.py,sha256=fp_TttpreG-FmCPOnD-jOH5HIMJS2RG4W1_eoJwo0lU,1466
|
|
31
|
+
decodo_sdk-2.2.0.dist-info/licenses/LICENSE,sha256=G9zLhirS-KF64j5DxLUkpuRebaE_VlIgLv0yqc4JMl0,1063
|
|
32
|
+
decodo_sdk-2.2.0.dist-info/METADATA,sha256=x_lwuHTAFiT80X2-7DD-xRAz9lhpOyU8S5mIYGkzV1w,18838
|
|
33
|
+
decodo_sdk-2.2.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
34
|
+
decodo_sdk-2.2.0.dist-info/top_level.txt,sha256=CgWDNooYyZEcGE2MkFl0AviiuFMSrYbBSG8N4-l6ITM,7
|
|
35
|
+
decodo_sdk-2.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Decodo
|
|
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 @@
|
|
|
1
|
+
decodo
|