decodo-sdk 2.2.0__tar.gz → 2.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.
Files changed (47) hide show
  1. decodo_sdk-2.3.0/PKG-INFO +661 -0
  2. decodo_sdk-2.3.0/README.md +611 -0
  3. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/pyproject.toml +1 -1
  4. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/__init__.py +2 -1
  5. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/api/web_scraping_api.py +23 -6
  6. decodo_sdk-2.3.0/src/decodo/client.py +103 -0
  7. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/generated/decodo.ir.json +1 -515
  8. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/generated/parameters.py +3 -13
  9. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/generated/targets.py +2 -348
  10. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/http.py +1 -1
  11. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/targets.py +0 -12
  12. decodo_sdk-2.3.0/src/decodo_sdk.egg-info/PKG-INFO +661 -0
  13. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo_sdk.egg-info/SOURCES.txt +1 -0
  14. decodo_sdk-2.3.0/tests/test_client.py +79 -0
  15. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/tests/test_http.py +31 -1
  16. decodo_sdk-2.2.0/PKG-INFO +0 -459
  17. decodo_sdk-2.2.0/README.md +0 -409
  18. decodo_sdk-2.2.0/src/decodo/client.py +0 -58
  19. decodo_sdk-2.2.0/src/decodo_sdk.egg-info/PKG-INFO +0 -459
  20. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/LICENSE +0 -0
  21. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/setup.cfg +0 -0
  22. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/api/__init__.py +0 -0
  23. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/codegen/__init__.py +0 -0
  24. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/codegen/codegen.py +0 -0
  25. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/codegen/web_scraping_api/__init__.py +0 -0
  26. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/codegen/web_scraping_api/generate_parameters.py +0 -0
  27. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/codegen/web_scraping_api/generate_targets.py +0 -0
  28. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/codegen/web_scraping_api/shared.py +0 -0
  29. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/codegen/web_scraping_api/types.py +0 -0
  30. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/errors.py +0 -0
  31. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/generated/__init__.py +0 -0
  32. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/py.typed +0 -0
  33. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/__init__.py +0 -0
  34. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/build_target_meta.py +0 -0
  35. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/bundled_schema.py +0 -0
  36. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/constants.py +0 -0
  37. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/expand_path.py +0 -0
  38. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/remote_schema.py +0 -0
  39. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/resolve_latest_ir.py +0 -0
  40. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/schema/types.py +0 -0
  41. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/types/__init__.py +0 -0
  42. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/types/requests.py +0 -0
  43. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo/types/responses.py +0 -0
  44. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo_sdk.egg-info/dependency_links.txt +0 -0
  45. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo_sdk.egg-info/requires.txt +0 -0
  46. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/src/decodo_sdk.egg-info/top_level.txt +0 -0
  47. {decodo_sdk-2.2.0 → decodo_sdk-2.3.0}/tests/test_web_scraping_api.py +0 -0
@@ -0,0 +1,661 @@
1
+ Metadata-Version: 2.4
2
+ Name: decodo-sdk
3
+ Version: 2.3.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
+ ![Python](https://img.shields.io/badge/python-%3E%3D3.12-green)
54
+ ![License](https://img.shields.io/badge/license-MIT-blue)
55
+
56
+ [![](https://dcbadge.limes.pink/api/server/https://discord.gg/Ja8dqKgvbZ)](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=python_sdk"> <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
+ Every target has a corresponding parameter class. Import the one you need, fill in its fields, and pass it to `scrape()`:
111
+
112
+ ```python
113
+ # main.py
114
+ from decodo import (
115
+ DecodoClient,
116
+ DecodoConfig,
117
+ GoogleSearchParams,
118
+ WebScrapingApiConfig,
119
+ )
120
+
121
+ client = DecodoClient(
122
+ DecodoConfig(
123
+ web_scraping_api=WebScrapingApiConfig(
124
+ token="<basic_auth_token>",
125
+ ),
126
+ )
127
+ )
128
+
129
+ result = client.web_scraping_api.scrape(
130
+ GoogleSearchParams(
131
+ query="coffee shops",
132
+ geo="United States",
133
+ parse=True,
134
+ )
135
+ )
136
+
137
+ print(result)
138
+ ```
139
+
140
+ Run the script:
141
+
142
+ ```
143
+ python main.py
144
+ ```
145
+
146
+ Parameter classes are bundled with the package, so no extra step is needed after `pip install decodo-sdk`. Each class pins its own target and accepts only the fields that target supports. Your IDE can flag misspelled or unsupported fields, while runtime validation catches them before the request is sent.
147
+
148
+ `GoogleSearchParams` is the parameter class for `Target.GoogleSearch`. The naming follows a simple pattern covered in [Targets and parameter classes](#targets-and-parameter-classes).
149
+
150
+ ### Alternative: dictionary payloads
151
+
152
+ Scraping methods also accept a plain Python dictionary. The payload is validated against the bundled schema before the request is sent, but nothing is checked while you write the code, so typos and unsupported fields surface only at runtime:
153
+
154
+ ```python
155
+ result = client.web_scraping_api.scrape({
156
+ "target": "google_search",
157
+ "query": "coffee shops",
158
+ "geo": "United States",
159
+ "parse": True,
160
+ })
161
+
162
+ print(result)
163
+ ```
164
+
165
+ Use the `Target` enum instead of a raw string to avoid mistyping the target name:
166
+
167
+ ```python
168
+ from decodo import Target
169
+
170
+ result = client.web_scraping_api.scrape({
171
+ "target": Target.GoogleSearch,
172
+ "query": "coffee shops",
173
+ "parse": True,
174
+ })
175
+
176
+ print(result)
177
+ ```
178
+
179
+ Typed parameters are recommended for anything beyond a quick experiment. The rest of this README uses the typed parameter approach throughout.
180
+
181
+ ### Updating types to a newer schema
182
+
183
+ 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:
184
+
185
+ ```bash
186
+ python -m decodo.codegen.codegen --out-dir ./decodo_generated
187
+ ```
188
+
189
+ Then import from that directory instead:
190
+
191
+ ```python
192
+ from decodo_generated.targets import GoogleSearchParams
193
+ ```
194
+
195
+ > 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.
196
+
197
+ <details>
198
+ <summary>Example response</summary>
199
+
200
+ ```json
201
+ {
202
+ "results": [
203
+ {
204
+ "content": {
205
+ "results": {
206
+ "last_visible_page": 10,
207
+ "page": 1,
208
+ "parse_status_code": 12000,
209
+ "results": {
210
+ "local_pack": [
211
+ {
212
+ "items": [
213
+ {
214
+ "address": "Rochester, NY",
215
+ "paid": false,
216
+ "pos": 1,
217
+ "rating": 4.9,
218
+ "rating_count": 1700,
219
+ "subtitle": "Coffee shop",
220
+ "title": "Albunn Coffee House"
221
+ },
222
+ {
223
+ "address": "Rochester, NY",
224
+ "paid": false,
225
+ "pos": 2,
226
+ "rating": 4.8,
227
+ "rating_count": 937,
228
+ "subtitle": "Coffee shop",
229
+ "title": "Layali Coffee House"
230
+ },
231
+ {
232
+ "address": "Ocean Township, NJ",
233
+ "paid": false,
234
+ "pos": 3,
235
+ "rating": 4.9,
236
+ "rating_count": 124,
237
+ "subtitle": "Coffee shop",
238
+ "title": "Ocean Brew Co."
239
+ }
240
+ ],
241
+ "pos_overall": 1
242
+ }
243
+ ],
244
+ "organic": [
245
+ {
246
+ "desc": "For an alternate, local view, Eater has an interesting list of what it considers Philadelphia's 21 Essential Coffee Shops.",
247
+ "pos": 1,
248
+ "pos_overall": 2,
249
+ "title": "Philadelphia",
250
+ "url": "https://www.brian-coffee-spot.com/the-coffee-spot-guide-to/usa-canada/philadelphia/"
251
+ }
252
+ ],
253
+ "search_information": {
254
+ "query": "coffee shops",
255
+ "total_results_count": 403000000
256
+ }
257
+ },
258
+ "url": "https://www.google.com/search?q=coffee+shops&hl=en&gl=us"
259
+ },
260
+ "errors": [],
261
+ "status_code": 12000,
262
+ "task_id": "7463508496927950850"
263
+ },
264
+ "status_code": 200,
265
+ "url": "https://www.google.com/search?q=coffee+shops&hl=en&gl=us",
266
+ "task_id": "7463508496927950850",
267
+ "created_at": "2026-05-22 08:38:10",
268
+ "updated_at": "2026-05-22 08:38:13"
269
+ }
270
+ ]
271
+ }
272
+ ```
273
+
274
+ </details>
275
+
276
+ ## Configuration
277
+
278
+ ```python
279
+ from decodo import (
280
+ DecodoClient,
281
+ DecodoConfig,
282
+ WebScrapingApiConfig,
283
+ )
284
+
285
+ client = DecodoClient(
286
+ DecodoConfig(
287
+ web_scraping_api=WebScrapingApiConfig(
288
+ token="<basic_auth_token>",
289
+ ),
290
+ timeout_ms=120_000, # optional, request timeout in ms (default: 180000)
291
+ )
292
+ )
293
+ ```
294
+
295
+ | Parameter | Description |
296
+ | --- | --- |
297
+ | `token` | Web Scraping API basic auth token, the base64-encoded `user:password` string from the Decodo dashboard |
298
+ | `timeout_ms` | Request timeout in milliseconds (default: 180000) |
299
+
300
+ ## Web Scraping API
301
+
302
+ Access the API via `client.web_scraping_api`.
303
+
304
+ The snippets below assume you have already constructed a client. See [Configuration](#configuration) for how to build one.
305
+
306
+ ### Sync scrape
307
+
308
+ Waits for the scraping result before returning:
309
+
310
+ ```python
311
+ from decodo import (
312
+ AmazonProductParams,
313
+ DecodoClient,
314
+ DecodoConfig,
315
+ WebScrapingApiConfig,
316
+ )
317
+
318
+ client = DecodoClient(
319
+ DecodoConfig(
320
+ web_scraping_api=WebScrapingApiConfig(
321
+ token="<basic_auth_token>",
322
+ ),
323
+ )
324
+ )
325
+
326
+ # Run the scrape and wait for the result.
327
+ result = client.web_scraping_api.scrape(
328
+ AmazonProductParams(
329
+ query="B09H74FXNW",
330
+ parse=True,
331
+ )
332
+ )
333
+
334
+ # Print the completed response.
335
+ print(result)
336
+ ```
337
+
338
+ ### Async scrape
339
+
340
+ Creates a scraping task and returns immediately, then you poll for status and results:
341
+
342
+ ```python
343
+ import time
344
+
345
+ from decodo import (
346
+ DecodoClient,
347
+ DecodoConfig,
348
+ GoogleSearchParams,
349
+ WebScrapingApiConfig,
350
+ )
351
+
352
+ client = DecodoClient(
353
+ DecodoConfig(
354
+ web_scraping_api=WebScrapingApiConfig(
355
+ token="<basic_auth_token>",
356
+ ),
357
+ )
358
+ )
359
+
360
+ # Submit the scraping task and return immediately.
361
+ task = client.web_scraping_api.scrape_async(
362
+ GoogleSearchParams(
363
+ query="laptop reviews",
364
+ parse=True,
365
+ )
366
+ )
367
+
368
+ # Save the returned task ID.
369
+ task_id = task["id"]
370
+
371
+ # Poll until the task finishes.
372
+ while True:
373
+ status = client.web_scraping_api.get_status(task_id)["status"]
374
+
375
+ if status == "done":
376
+ break
377
+
378
+ if status == "faulted":
379
+ raise RuntimeError(f"Scraping task {task_id} failed.")
380
+
381
+ time.sleep(2)
382
+
383
+ # Retrieve and print the completed result.
384
+ result = client.web_scraping_api.get_results(task_id)
385
+
386
+ print(result)
387
+ ```
388
+
389
+ `get_status` returns `pending`, `done`, or `faulted`.
390
+
391
+ ### Batch scrape
392
+
393
+ Send multiple inputs in a single request. Batch calls use the batch variant of the target's parameter class, where the primary input accepts a list:
394
+
395
+ ```python
396
+ import time
397
+
398
+ from decodo import (
399
+ DecodoClient,
400
+ DecodoConfig,
401
+ GoogleSearchBatchParams,
402
+ WebScrapingApiConfig,
403
+ )
404
+
405
+ client = DecodoClient(
406
+ DecodoConfig(
407
+ web_scraping_api=WebScrapingApiConfig(
408
+ token="<basic_auth_token>",
409
+ ),
410
+ )
411
+ )
412
+
413
+ # Submit multiple queries in a single batch request.
414
+ # For another target, use its batch parameter class and primary input.
415
+ batch = client.web_scraping_api.scrape_batch(
416
+ GoogleSearchBatchParams(
417
+ query=["coffee", "tea", "juice"],
418
+ parse=True,
419
+ )
420
+ )
421
+
422
+ # Wait for each task and print its completed result.
423
+ for task in batch["queries"]:
424
+ task_id = task["id"]
425
+
426
+ while True:
427
+ status = client.web_scraping_api.get_status(task_id)["status"]
428
+
429
+ if status == "done":
430
+ break
431
+
432
+ if status == "faulted":
433
+ raise RuntimeError(f"Scraping task {task_id} failed.")
434
+
435
+ time.sleep(2)
436
+
437
+ result = client.web_scraping_api.get_results(task_id)
438
+
439
+ print(result)
440
+ ```
441
+
442
+ ## Targets and parameter classes
443
+
444
+ Every target in the `Target` enum has a matching parameter class. The name of the class is the enum member name followed by `Params`:
445
+
446
+ ```
447
+ Target.GoogleSearch → GoogleSearchParams
448
+ Target.Chatgpt → ChatgptParams
449
+ Target.Airbnb → AirbnbParams
450
+ ```
451
+
452
+ For batch calls, insert `Batch` before `Params`. The batch class takes a list for the primary input and otherwise behaves the same:
453
+
454
+ ```
455
+ Target.GoogleSearch → GoogleSearchBatchParams
456
+ Target.Chatgpt → ChatgptBatchParams
457
+ Target.Airbnb → AirbnbBatchParams
458
+ ```
459
+
460
+ Two things follow from this:
461
+
462
+ - **You don't need to pass a target**. Each class already pins its own target, so `GoogleSearchParams(query="coffee shops")` is complete. Passing `target=Target.GoogleSearch` explicitly is allowed and type-checked, just redundant.
463
+ - **The `Target` enum is still useful**. Reach for it when you build dictionary payloads, or when you read the `target` field back off a response.
464
+
465
+ One target breaks the rule. `Target.Target` maps to `TargetStoreParams` and `TargetStoreBatchParams`, not `TargetParams`. Every other target is mechanical.
466
+
467
+ Each target accepts one primary input parameter (`url`, `query`, `product_id`, or `prompt`) together with optional configuration. The tables below show that primary input.
468
+
469
+ ### Search engines
470
+
471
+ | Target | Parameter class | Description | Example input |
472
+ | --- | --- | --- | --- |
473
+ | `Target.GoogleSearch` | `GoogleSearchParams` | Google Search results for a query | `query="coffee shops"` |
474
+ | `Target.GoogleMaps` | `GoogleMapsParams` | Google Maps search results | `query="coffee shops brooklyn"` |
475
+ | `Target.GoogleShoppingSearch` | `GoogleShoppingSearchParams` | Google Shopping search results | `query="laptop"` |
476
+ | `Target.GoogleShoppingProduct` | `GoogleShoppingProductParams` | Google Shopping product page | `query="laptop"` |
477
+ | `Target.GoogleSuggest` | `GoogleSuggestParams` | Google Autocomplete suggestions | `query="coffee"` |
478
+ | `Target.GoogleLens` | `GoogleLensParams` | Google Lens reverse image search | `query="https://example.com/cat.jpg"` |
479
+ | `Target.GoogleTravelHotels` | `GoogleTravelHotelsParams` | Google Travel hotel listings | `query="hotels in paris"` |
480
+ | `Target.GoogleTrendsExplore` | `GoogleTrendsExploreParams` | Google Trends explore data | `query="coffee"` |
481
+ | `Target.GoogleAds` | `GoogleAdsParams` | Google Ads results for a query | `query="laptop"` |
482
+ | `Target.BingSearch` | `BingSearchParams` | Bing Search results | `query="electric vehicles"` |
483
+ | `Target.Bing` | `BingParams` | Raw Bing URL scraping | `url="https://bing.com/search?q=laptop"` |
484
+
485
+ ### eCommerce
486
+
487
+ | Target | Parameter class | Description | Example input |
488
+ | --- | --- | --- | --- |
489
+ | `Target.AmazonProduct` | `AmazonProductParams` | Amazon product detail page by ASIN | `query="B09H74FXNW"` |
490
+ | `Target.AmazonSearch` | `AmazonSearchParams` | Amazon search results | `query="laptop"` |
491
+ | `Target.AmazonPricing` | `AmazonPricingParams` | Amazon pricing and offers | `query="B09H74FXNW"` |
492
+ | `Target.AmazonSellers` | `AmazonSellersParams` | Amazon seller listings | `query="B09H74FXNW"` |
493
+ | `Target.AmazonBestsellers` | `AmazonBestsellersParams` | Amazon bestsellers by category | `query="electronics"` |
494
+ | `Target.WalmartProduct` | `WalmartProductParams` | Walmart product page by product ID | `product_id="15296401808"` |
495
+ | `Target.WalmartSearch` | `WalmartSearchParams` | Walmart search results | `query="laptop"` |
496
+ | `Target.Walmart` | `WalmartParams` | Raw Walmart URL scraping | `url="https://walmart.com/ip/15296401808"` |
497
+ | `Target.TargetProduct` | `TargetProductParams` | Target.com product page by product ID | `product_id="92186007"` |
498
+ | `Target.TargetSearch` | `TargetSearchParams` | Target.com search results | `query="laptop"` |
499
+ | `Target.Target` | `TargetStoreParams` | Raw Target.com URL scraping | `url="https://target.com/p/-/A-92186007"` |
500
+ | `Target.LowesSearch` | `LowesSearchParams` | Lowe's search results | `query="drill"` |
501
+ | `Target.Ecommerce` | `EcommerceParams` | Generic eCommerce page with parser | `url="https://example.com/product/123"` |
502
+
503
+ ### Social media
504
+
505
+ | Target | Parameter class | Description | Example input |
506
+ | --- | --- | --- | --- |
507
+ | `Target.RedditPost` | `RedditPostParams` | Reddit post by URL | `url="https://reddit.com/r/nba/comments/..."` |
508
+ | `Target.RedditSubreddit` | `RedditSubredditParams` | Reddit subreddit by URL | `url="https://reddit.com/r/nba/"` |
509
+ | `Target.RedditUser` | `RedditUserParams` | Reddit user profile by URL | `url="https://reddit.com/user/example/"` |
510
+ | `Target.YoutubeVideo` | `YoutubeVideoParams` | YouTube video by ID | `query="dFu9aKJoqGg"` |
511
+ | `Target.YoutubeSearch` | `YoutubeSearchParams` | YouTube search results | `query="ambient music"` |
512
+ | `Target.YoutubeSearchMax` | `YoutubeSearchMaxParams` | YouTube search results (extended) | `query="ambient music"` |
513
+ | `Target.YoutubeMetadata` | `YoutubeMetadataParams` | YouTube video metadata by ID | `query="dFu9aKJoqGg"` |
514
+ | `Target.YoutubeTranscript` | `YoutubeTranscriptParams` | YouTube video transcript by ID | `query="dFu9aKJoqGg"` |
515
+ | `Target.YoutubeSubtitles` | `YoutubeSubtitlesParams` | YouTube video subtitles by ID | `query="dFu9aKJoqGg"` |
516
+ | `Target.YoutubeChannel` | `YoutubeChannelParams` | YouTube channel by handle or ID | `query="@decodo_official"` |
517
+ | `Target.TiktokPost` | `TiktokPostParams` | TikTok post by URL | `url="https://www.tiktok.com/@nba/video/..."` |
518
+ | `Target.TiktokShopSearch` | `TiktokShopSearchParams` | TikTok Shop search results | `query="wireless earbuds"` |
519
+ | `Target.TiktokShopProduct` | `TiktokShopProductParams` | TikTok Shop product page by product ID | `product_id="7100000000000000000"` |
520
+ | `Target.Tiktok` | `TiktokParams` | Raw TikTok URL scraping | `url="https://www.tiktok.com/@nba"` |
521
+ | `Target.InstagramGraphqlProfile` | `InstagramGraphqlProfileParams` | Instagram profile via GraphQL | `query="nba"` |
522
+
523
+ ### AI tools
524
+
525
+ | Target | Parameter class | Description | Example input |
526
+ | --- | --- | --- | --- |
527
+ | `Target.Chatgpt` | `ChatgptParams` | ChatGPT response for a prompt | `prompt="What are the top three dog breeds?"` |
528
+ | `Target.Perplexity` | `PerplexityParams` | Perplexity response for a prompt | `prompt="What causes seasonal allergies?"` |
529
+ | `Target.Gemini` | `GeminiParams` | Gemini response for a prompt | `prompt="What are the top three dog breeds?"` |
530
+ | `Target.GoogleAiMode` | `GoogleAiModeParams` | Google AI Mode response | `query="What are the top three dog breeds?"` |
531
+
532
+ ### Other
533
+
534
+ | Target | Parameter class | Description | Example input |
535
+ | --- | --- | --- | --- |
536
+ | `Target.Bbb` | `BbbParams` | Better Business Bureau listing by URL | `url="https://bbb.org/us/ny/new-york/..."` |
537
+ | `Target.Autotrader` | `AutotraderParams` | Autotrader listing by URL | `url="https://autotrader.com/cars-for-sale/..."` |
538
+ | `Target.Mobile` | `MobileParams` | Mobile.de listing by URL | `url="https://mobile.de/auto/..."` |
539
+ | `Target.Airbnb` | `AirbnbParams` | Airbnb listing by URL | `url="https://airbnb.com/rooms/12345"` |
540
+ | `Target.AppleAppStore` | `AppleAppStoreParams` | Apple App Store app by URL | `url="https://apps.apple.com/app/id12345"` |
541
+
542
+ ### Universal scraping
543
+
544
+ | Target | Parameter class | Description | Example input |
545
+ | --- | --- | --- | --- |
546
+ | `Target.Universal` | `UniversalParams` | Any URL via the universal scraper | `url="https://example.com"` |
547
+ | `Target.Google` | `GoogleParams` | Raw Google URL scraping | `url="https://google.com/search?q=laptop"` |
548
+ | `Target.Amazon` | `AmazonParams` | Raw Amazon URL scraping | `url="https://amazon.com/dp/B09H74FXNW"` |
549
+
550
+
551
+ > `Target.UniversalEcommerce` isn't listed above because it doesn't accept a primary input parameter like `url`, `query`, `product_id`, or `prompt`. Its parameter class `UniversalEcommerceParams` only accepts optional configuration fields such as `callback_url`.
552
+
553
+ For the full target list and parameter details, see the API documentation:
554
+
555
+ - [Target list](https://help.decodo.com/docs/web-scraping-api-targets)
556
+ - [Parameters](https://help.decodo.com/docs/web-scraping-api-parameters)
557
+
558
+ ## Error handling
559
+
560
+ The SDK raises typed errors that map to API error codes:
561
+
562
+ ```python
563
+ import time
564
+
565
+ from decodo import (
566
+ AuthenticationError,
567
+ DecodoClient,
568
+ DecodoConfig,
569
+ DecodoError,
570
+ GoogleSearchParams,
571
+ RateLimitError,
572
+ TimeoutError,
573
+ ValidationError,
574
+ WebScrapingApiConfig,
575
+ )
576
+
577
+ client = DecodoClient(
578
+ DecodoConfig(
579
+ web_scraping_api=WebScrapingApiConfig(
580
+ token="<basic_auth_token>",
581
+ ),
582
+ )
583
+ )
584
+
585
+ params = GoogleSearchParams(
586
+ query="coffee shops",
587
+ geo="United States",
588
+ parse=True,
589
+ )
590
+
591
+
592
+ def print_organic_results(response):
593
+ parsed = response["results"][0]["content"]["results"]["results"]
594
+
595
+ for item in parsed["organic"]:
596
+ print(item["pos"], item["title"], item["url"])
597
+
598
+
599
+ try:
600
+ response = client.web_scraping_api.scrape(params)
601
+ print_organic_results(response)
602
+
603
+ except AuthenticationError:
604
+ # Handle authentication failures.
605
+ raise SystemExit(
606
+ "Invalid token. Check the Basic Auth credentials in your dashboard."
607
+ )
608
+
609
+ except RateLimitError:
610
+ # Retry once after a short delay.
611
+ time.sleep(5)
612
+ response = client.web_scraping_api.scrape(params)
613
+ print_organic_results(response)
614
+
615
+ except ValidationError as err:
616
+ # Handle invalid request parameters.
617
+ print("Payload rejected:", err.errors or err)
618
+
619
+ except TimeoutError:
620
+ # Handle request timeouts.
621
+ print(
622
+ "Timed out. Increase timeout_ms or switch to scrape_async for slow targets."
623
+ )
624
+
625
+ except DecodoError as err:
626
+ # Catch any other SDK errors.
627
+ print(f"Request failed with {err.status_code}: {err}")
628
+ ```
629
+
630
+ The `["results"]["results"]` nesting above is the shape returned when `parse=True`. Without it, `content` holds the raw page instead.
631
+
632
+ | Error | Raised when | Useful attributes |
633
+ | --- | --- | --- |
634
+ | `AuthenticationError` | The API returns `401` or `403` | `status_code` |
635
+ | `RateLimitError` | The API returns `429` | `status_code` |
636
+ | `ValidationError` | The payload fails local schema validation, or the API returns `422` | `errors`, `status_code` |
637
+ | `TimeoutError` | The request exceeds `timeout_ms` | none |
638
+ | `DecodoError` | Any other unsuccessful response. Base class for the three errors above | `status_code`, `api_status` |
639
+
640
+ Two things to keep in mind:
641
+
642
+ - **`TimeoutError` sits outside the `DecodoError` hierarchy**, so `except DecodoError` won't catch it. Catch it separately, as in the example above. Importing it from `decodo` also shadows the built-in `TimeoutError` in that module.
643
+ - **Typed parameters fail earlier than this**. An unknown field or a wrong type raises `pydantic.ValidationError` when you construct the parameter object, before any request is made. `decodo.ValidationError` covers payloads that are well-formed Python but rejected by the schema or the API.
644
+
645
+ ## Related repositories
646
+
647
+ - [Web Scraping API](https://github.com/Decodo/Web-Scraping-API)
648
+ - [Decodo MCP Server](https://github.com/Decodo/mcp-server)
649
+ - [Decodo OpenClaw Skill](https://github.com/Decodo/decodo-openclaw-skill)
650
+
651
+ ## Get started
652
+
653
+ Build scraping workflows with the Decodo Web Scraping API:
654
+
655
+ - [Start free plan](https://dashboard.decodo.com/)
656
+ - [Documentation](https://help.decodo.com/docs/introduction)
657
+ - [Discord](https://discord.gg/Ja8dqKgvbZ)
658
+
659
+ ## License
660
+
661
+ Released under the [MIT License](https://github.com/Decodo/Decodo/blob/master/LICENSE).