The Spider Cloud Python SDK offers a toolkit for straightforward website scraping, crawling at scale, and other utilities like extracting links and taking screenshots, enabling you to collect data formatted for compatibility with language models (LLMs). It features a user-friendly interface for seamless integration with the Spider Cloud API.
Installation
To install the Spider Cloud Python SDK, you can use pip:
You can check the remaining credits on your account:
credits = app.get_credits()
Unblocker
Access blocked or protected content with anti-bot bypass:
url = 'https://protected-site.com'
result = app.unblocker(url)
Unblocker with AI Extraction
Unblock and extract structured data using AI:
url = 'https://protected-site.com/products'
result = app.unblocker(url, params={
'custom_prompt': 'Extract all product names and prices as JSON'
})
# Extracted data is available in result[0]['metadata']['extracted_data']
Unblocker with JSON Schema Extraction
Use JSON Schema for structured, validated extraction output:
AI Studio methods require an active AI Studio subscription. See spider.cloud/ai/pricing for plans.
AI Crawl
AI-guided crawling using natural language prompts:
result = app.ai_crawl(
url='https://example.com',
prompt='Find all blog posts and extract titles and summaries'
)
AI Scrape
AI-guided scraping using natural language prompts:
result = app.ai_scrape(
url='https://example.com/products',
prompt='Extract all product names, prices, and descriptions'
)
AI Search
AI-enhanced web search using natural language:
result = app.ai_search(prompt='Find the best Python web scraping libraries')
AI Browser
AI-guided browser automation:
result = app.ai_browser(
url='https://example.com/login',
prompt='Click the sign in button and fill the email field with test@example.com'
)
AI Links
AI-guided link extraction and filtering:
result = app.ai_links(
url='https://example.com',
prompt='Find all links to product pages and documentation'
)
Unlimited Methods
Unlimited methods require an active Unlimited subscription. See spider.cloud/pricing?plan=unlimited for plans. The plan is a flat monthly rate billed by purchased concurrency seats (the number of requests in flight at once) instead of per-request credits.
There is no queueing: when all purchased seats are in flight, the API returns an immediate 429 with a Retry-After header — retry with backoff. Every response carries X-Concurrency-Limit and X-Concurrency-Active headers. AI/LLM extraction params (prompt, custom_prompt, extraction_prompt, extraction_schema, model/vision params) are rejected with a 400; AI usage is billed separately via the ai_* methods. See the Unlimited API docs for details.
Streaming
If you need to stream the request use the third param:
The following Content-type headers are supported using the fourth param:
application/json
text/csv
application/xml
application/jsonl
url = 'https://example.com'
crawler_params = {
'limit': 1,
'proxy_enabled': True,
'metadata': False,
'request': 'http'
}
# stream json lines back to the client
links = app.crawl(url, crawler_params, True, "application/jsonl")
Error Handling
The SDK handles errors returned by the Spider Cloud API and raises appropriate exceptions. If an error occurs during a request, an exception will be raised with a descriptive error message.
Contributing
Contributions to the Spider Cloud Python SDK are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
License
The Spider Cloud Python SDK is open-source and released under the MIT License.
Alternatives
Use instead of spider-client: tools that do the same job, closest first.
Python SDK for Firecrawl: search, scrape, parse, crawl, map, and interact with the web, run Agent and Monitor jobs, and search scientific papers (PubMed, bioRxiv, medRxiv, arXiv)