View the Python SDK GitHub repository for the latest installation instructions, examples, and source code.
- Fully typed targets and parameters with IDE autocomplete
- Sync, async, and batch scraping methods
- Built on
httpx; requires Python 3.12 or later - Typed error hierarchy for safer integrations
What is the Decodo Python SDK?
The Decodo Python SDK provides a typed interface for interacting with Decodo targets like Google, Amazon, TikTok, Reddit, YouTube, ChatGPT, Perplexity, and more. Instead of manually constructing HTTP requests and validating payloads, you work with fully typed methods and target-specific parameter classes directly in your editor.Why use the SDK?
- Typing and autocomplete – target parameters are fully typed for better editor support and fewer mistakes.
- Unified scraping interface – work with search engines, eCommerce platforms, social media, and AI tools through one SDK.
- Async and batch workflows – create scraping tasks, poll task status, and process batches at scale.
- Typed errors – handle authentication, validation, timeout, and rate-limit failures safely.
- Minimal setup – single dependency on
httpx, no additional HTTP client required.
Requirements
- Python 3.12+
Installation
Quick start
Create a new project:scrape():
pip install decodo-sdk.
Each class pins its own target and accepts only the fields that target supports - your IDE flags misspelled or unsupported fields, and runtime validation catches them before the request is sent.
Alternative: dictionary payloads
Scraping methods also accept a plain Python dictionary, validated against the bundled schema before the request is sent:Target enum instead of a raw string to avoid mistyping the target name. Typed parameter classes are recommended for anything beyond a quick experiment.
Configuration
Web Scraping API
Access the API viaclient.web_scraping_api.
Sync scrape
Waits for the scraping result before returning:Async scrape
Creates a scraping task and returns immediately. You then poll for its status and results:get_status returns pending, done, or faulted.
Batch scrape
Send multiple inputs in a single request using the batch variant of a target’s parameter class. The primary input accepts a list:Targets and parameter classes
Every target in theTarget enum has a matching parameter class. The enum member name is followed by Params – for example, Target.GoogleSearch → GoogleSearchParams and Target.Chatgpt → ChatgptParams. For batch calls, insert Batch before Params, as in GoogleSearchBatchParams.
You don’t need to pass a target explicitly because each parameter class already pins its own target. For example, GoogleSearchParams(query="coffee shops") is sufficient on its own. The Target enum remains useful for dictionary payloads and for reading the target field from a response.
One target breaks the naming rule:
Target.Target maps to TargetStoreParams (not TargetParams), to avoid a name clash. Every other target follows the pattern.url, query, product_id, or prompt) together with optional configuration.
Search engines
eCommerce
Social media
AI tools
Universal scraping
Target.UniversalEcommerce isn’t included in the table because its parameter class UniversalEcommerceParams only accepts optional configuration fields such as callback_url, with no primary input. Use Ecommerce for generic product pages or Universal for any URL.Error handling
The SDK raises typed errors that map to API error codes:TimeoutError sits outside the DecodoError hierarchy, so except DecodoError won’t catch it. Handle it separately.Typed parameters can also fail before a request is sent. An unknown field or incorrect type raises pydantic.ValidationError when the parameter object is created.Related
- CLI – Run Decodo scraping workflows from the command line.
- TypeScript SDK – Integrate the Web Scraping API into TypeScript and JavaScript projects.
- Go SDK – Integrate the Web Scraping API into Go projects.
- MCP Server – Connect AI agents and MCP-compatible tools to Decodo.
- GitHub repository – View the Python SDK source code, examples, and latest releases.
Support
Need help or just want to say hello? Our support is available 24/7.
You can also reach us anytime via email at support@decodo.com.
You can also reach us anytime via email at support@decodo.com.
Feedback
Can’t find what you’re looking for? Request an article!
Have feedback? Share your thoughts on how we can improve.
Have feedback? Share your thoughts on how we can improve.