Skip to main content

Python SDK for the Scraping Pros API — web scraping with browser rendering, proxy rotation, and structured data extraction.

Project description

scrapingpros

Python SDK for the Scraping Pros API — web scraping with browser rendering, proxy rotation, and structured data extraction.

Installation

pip install scrapingpros

Quick Start

No signup needed — use the demo token to start immediately:

from scrapingpros import ScrapingPros

client = ScrapingPros("demo_6x595maoA6GdOdVb")
result = client.scrape("https://example.com")
print(result.html)

The demo token includes 5,000 credits/month and 30 req/min (1 simple request = 1 credit, 1 browser request = 5 credits). Credits are NOT consumed for requests that fail due to infrastructure errors. For higher limits, contact the Scraping Pros team.

Usage Examples

Markdown Output (for AI/LLM)

result = client.scrape("https://example.com", format="markdown")
print(result.markdown)

Browser Rendering

result = client.scrape(
    "https://spa-site.com",
    browser=True,
    use_proxy="any",
)

Structured Data Extraction

result = client.scrape(
    "https://quotes.toscrape.com/",
    extract={
        "quotes": {"selector": "css:.text", "multiple": True},
        "authors": {"selector": "css:.author", "multiple": True},
    },
)
print(result.extracted_data["quotes"])

Async Batch Processing

collection = client.create_collection("my-batch", [
    {"url": "https://example.com/1"},
    {"url": "https://example.com/2"},
])
run = client.run_and_wait(collection.id)
print(f"Done: {run.success_requests}/{run.total_requests}")

Async Client

from scrapingpros import AsyncScrapingPros

async with AsyncScrapingPros("demo_6x595maoA6GdOdVb") as client:
    result = await client.scrape("https://example.com", format="markdown")

API Methods

Method Description
client.scrape(url, ...) Scrape a URL (HTML or markdown)
client.download(url, ...) Download a file as base64
client.create_collection(name, requests) Create a batch collection
client.run_and_wait(collection_id) Run a batch and wait for completion
client.create_viability_test(urls) Analyze sites before scraping
client.list_proxy_countries() List available proxy countries
client.billing() Check usage and billing
client.health() API health check

Error Handling

from scrapingpros import ScrapingPros, AuthenticationError, RateLimitError, QuotaExceededError

try:
    result = client.scrape("https://example.com")
except AuthenticationError:
    print("Invalid token — use demo_6x595maoA6GdOdVb for testing")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except QuotaExceededError:
    print("Monthly quota exceeded — upgrade your plan for more requests")

All exceptions inherit from ScrapingProsError.

Usage & Quota Tracking

# Check remaining quota after any API call
client.scrape("https://example.com")
print(f"Requests remaining: {client.quota_remaining}")
print(f"Rate limit remaining: {client.rate_limit_remaining}")

# Get detailed billing info
billing = client.billing()

Plans

Plan Price Credits/mo Rate Concurrent
Demo (public) Free 5,000 30/min 5
Free $0 1,000 30/min 5
Starter $29 25,000 30/min 10
Growth $69 100,000 60/min 20
Pro $199 500,000 120/min 50
Scale $499 2,500,000 200/min 100
Enterprise Custom Unlimited 2000/min 100

1 simple request = 1 credit, 1 browser request = 5 credits. See all features: client.plans() or visit scrapingpros.com.

Configuration

client = ScrapingPros(
    "demo_6x595maoA6GdOdVb",  # or your dedicated token / SP_TOKEN env var
    base_url="https://api.scrapingpros.com",  # default
    timeout=120.0,         # request timeout in seconds
    max_retries=3,         # auto-retry on 429
)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrapingpros-0.2.1.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrapingpros-0.2.1-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file scrapingpros-0.2.1.tar.gz.

File metadata

  • Download URL: scrapingpros-0.2.1.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for scrapingpros-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3e857076dccd04663a63196af254e72fed3fc4258b1840c41b9345c517fbf914
MD5 eac5239f71e515ad1e21ba42069d1b3c
BLAKE2b-256 ec833ab017710ca143fab0eae88a2ed9c50ed12bdaae51f8d7989e83699d97f0

See more details on using hashes here.

File details

Details for the file scrapingpros-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: scrapingpros-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for scrapingpros-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9aa067b1b3c28635f70a0df77535a77241be5054eaa1ba44e0e8d75e745f969a
MD5 c7e272324bec69ff95f8a3cd1fbd9426
BLAKE2b-256 4a72fe7ad50c862cb28df0b5d214d3835daabe46e10fa5e7f9e6ccf54482f87f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page