Scraping AI Python SDK (scraping-ai)
A modern, type-safe Python SDK for interacting with Scraping AI service API endpoints. It supports both synchronous and asynchronous operations using httpx and pydantic.
This SDK focuses strictly on core service execution endpoints (pipeline orchestration, web extraction, crawling, finder, keywords, etc.), excluding account management, billing, payments, and administrative routes.
Installation
pip install scraping-ai
Quick Start (High-Level 1-Line Helpers)
1. Web Extraction in 1 Line
from scraping_ai import ScrapingAIClient
client = ScrapingAIClient(api_key="your_api_key_here")
# Extract web data directly in one step (polls until finished)
data = client.extract(
url="https://example.com",
schema={"title": "string", "price": "number"}
)
print(data.results)
2. Page Crawling in 1 Line
# Crawl a web page and get extracted content & markdown
crawl_result = client.crawl(url="https://example.com", use_browser=True)
print(crawl_result.results)
3. Discover URLs in 1 Line
# Discover URLs on a target site up to a specific depth
found_urls = client.find_urls(base_url="https://example.com", max_depth=2)
print(found_urls.results)
4. Keyword Generation in 1 Line
# Generate relevant search keywords for a topic
keywords_res = client.generate_keywords(context="dummy_context", num_keywords=15)
print(keywords_res.keywords)
5. Schema Generation in 1 Line
# Generate JSON Schema for an extraction prompt
schema_res = client.generate_schema(schema_instruction="Extract title, author, date")
print(schema_res.schema_)
Asynchronous Usage
import asyncio
from scraping_ai import AsyncScrapingAIClient
async def main():
async with AsyncScrapingAIClient(api_key="your_api_key_here") as client:
# Async one-liner extraction
data = await client.extract(url="https://example.com")
print(data.results)
asyncio.run(main())
Service Modules Overview
The SDK exposes low-level module controllers under clean, intuitive client attributes:
- 1-Line Helpers:
client.extract(...),client.crawl(...),client.find_urls(...),client.generate_keywords(...),client.generate_schema(...). client.extractor: Data extraction module (run,status,result).client.crawler: Page crawling module (run,status,result).client.finder: URL discovery module (run,status,result).client.keywords: Keyword generation module (run,status,result).client.schema: JSON Schema generation module (run,status,result).client.ranker: Relevance ranking module (run,status,result).client.search_url: Search URL generator module (run,status,result).client.search_results: Search results discovery module (run,status,result).client.exports: S3 exports management (create,list,get).client.pipeline: Multi-step pipeline orchestration (create,list,get,patch,run_flow,wait_for_task).client.data: Query extracted records (get_by_state,export_by_state).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scraping_ai-0.4.1.tar.gz.
File metadata
- Download URL: scraping_ai-0.4.1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d71ce073798e2d036a28edacbf7d519d708f75a1679c8703494b00a4d7cb8d4
|
|
| MD5 |
4f0507b5e1bb91e85b1f6441e4870583
|
|
| BLAKE2b-256 |
b75543bc74db26b8599556fdebb1b1514be0724331427b1d392c2349d7bcda4f
|
File details
Details for the file scraping_ai-0.4.1-py3-none-any.whl.
File metadata
- Download URL: scraping_ai-0.4.1-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94b2bfda79b2b9a63ad5296384f5a31aad7bb8201a5a2b09a865c8cf17b7c5df
|
|
| MD5 |
e698d9dfc74909017086a44e45f5ac37
|
|
| BLAKE2b-256 |
9e3663ffce6cc3b03b713d6e7ba88ac27091552e363f03316e5b2458edef4dc0
|