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
1. One-Line Data Extraction
from scraping_ai import ScrapingAIClient
client = ScrapingAIClient(api_key="your_api_key_here")
# Extract web data directly in one step
data = client.extract(
url="https://example.com",
schema={"title": "string", "price": "number"}
)
print(data)
2. Standalone Service Modules (Keywords, Crawler, Finder, Extractor, etc.)
import asyncio
from scraping_ai import AsyncScrapingAIClient
async def main():
async with AsyncScrapingAIClient(api_key="your_api_key_here") as client:
# Start keyword generation
run_info = await client.keywords.run(context="dummy_context", num_keywords=10)
print(f"Accepted run for State ID {run_info.state_id}")
# Check status
status_info = await client.keywords.status(run_info.state_id)
print(f"Current status: {status_info.status}")
# Retrieve result when finished
res = await client.keywords.result(run_info.state_id)
print(f"Keywords generated: {res.keywords}")
asyncio.run(main())
3. Pipeline Orchestration
from scraping_ai import ScrapingAIClient
client = ScrapingAIClient(api_key="your_api_key_here")
# Create a multi-step pipeline job
state = client.pipeline.create(
base_url="https://example.com",
user_instruction="dummy_user_instruction",
schema_instruction="dummy_schema_instruction"
)
flow = client.pipeline.run_flow(state.id)
print(f"Pipeline started: {flow.first_step}")
Service Modules Overview
The SDK exposes all service operations under clean client modules:
client.extract(url, ...): One-step extraction helper.client.generate_keywords(context, ...): One-step keyword generation helper.client.pipeline: Pipeline creation, orchestration, auto-flow, and status polling.client.keywords: Standalone keyword generation module (run,status,result).client.finder: URL discovery module (run,status,result).client.crawler: Page crawling module (run,status,result).client.extractor: Data extraction module (run,status,result).client.ranker: Relevance ranking module (run,status,result).client.schema: JSON Schema generation 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.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.0.tar.gz.
File metadata
- Download URL: scraping_ai-0.4.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86fa2f9c3881c7e47de4629594df27590609ce08e488c8b4467f6bedb3e800f2
|
|
| MD5 |
b83d4a707eb8b3c8e0720a0ce5d05e70
|
|
| BLAKE2b-256 |
ec3099bcd89264c02161d5e6cb6dce713b6a3f079fcc00990d297cb7ea8f6532
|
File details
Details for the file scraping_ai-0.4.0-py3-none-any.whl.
File metadata
- Download URL: scraping_ai-0.4.0-py3-none-any.whl
- Upload date:
- Size: 11.0 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 |
6f1555bc10b20c868ee9857fb122b4096564431f6d0d36b37429625065fbe9b3
|
|
| MD5 |
adce63d0e2b2cd513e6777512b4f5a43
|
|
| BLAKE2b-256 |
f6fee66649cad1d496c3b0b7c343eee29f9c686436825aa1c28a7e50cc6c3a53
|