Skip to main content

web-scraping-api-sdk

A Python client for the ScrapingBee web scraping API. It wraps the HTML API, Auto-Mode cost control, and all nine dedicated scraper endpoints behind one class.

This package talks to ScrapingBee (app.scrapingbee.com). It is an independent client, published separately from ScrapingBee's own scrapingbee SDK. You need a ScrapingBee API key to use it: app.scrapingbee.com, 1,000 free credits on signup.

Install

pip install web-scraping-api-sdk

Quickstart

from web_scraping_api_sdk import ScrapingBeeAPI

api = ScrapingBeeAPI("YOUR-API-KEY")

page = api.scrape("https://news.ycombinator.com", render_js=False)
print(page.status_code, page.cost, page.request_id)
print(page.text[:500])

Authentication uses the Authorization: Bearer header. ScrapingBee still accepts the api_key query parameter but marks it deprecated, so this client does not use it.

Auto-Mode

Choosing a proxy tier by hand means overpaying on easy pages or getting blocked on hard ones. auto() asks ScrapingBee to try configurations from cheapest to most expensive and charge only for the one that works:

page = api.auto("https://example.com", max_cost=25)
print(page.auto_cost)   # one of 1, 5, 10, 25 or 0 if every tier failed

max_cost=25 allows premium proxy with JavaScript but never the 75-credit stealth tier. When every configuration fails, the request costs nothing.

Endpoint reference

Method Endpoint Credits
scrape(url, **params) /api/v1 1 to 75, plus 5 for AI parameters
auto(url, max_cost=None) /api/v1 with mode=auto only the tier that succeeds, 0 on total failure
screenshot(url, full_page=False) /api/v1 with screenshot same ladder as scrape
google(search, search_type=...) /api/v1/google 15, or 10 light
fast_search(search) /api/v1/fast_search 10
amazon_search(query) /api/v1/amazon/search 5 light, 15 standard
amazon_product(asin) /api/v1/amazon/product 5 light, 15 standard
amazon_pricing(asin) /api/v1/amazon/pricing/ 5 light, 15 standard
walmart_search(query) /api/v1/walmart/search 10 light, 15 standard
walmart_product(product_id) /api/v1/walmart/product 10 light, 15 standard
youtube_search(search) /api/v1/youtube/search 5
youtube_metadata(search) /api/v1/youtube/metadata 5
youtube_subtitles(search) /api/v1/youtube/subtitles 5
chatgpt(prompt) /api/v1/chatgpt 15
gemini(prompt) /api/v1/gemini 15
shopee(url) /api/v1/shopee 75
agentic_search(prompt, limit) /api/v1/agentic_search 3,750
usage() /api/v1/usage free, 6 calls per minute

Google surfaces

One parameter switches between eight result types:

api.google("web scraping api", search_type="news", country_code="us")
api.google("running shoes", search_type="shopping", min_price=50, sort_by="price_low_to_high")
api.google("how does virtual interlining work", search_type="ai_mode")

Accepted values: classic, news, maps, images, lens, shopping, ai_mode, ads. news is unavailable with device="mobile", lens expects an image URL, and ai_mode caps the query at 400 characters.

Reading the cost

Every response exposes the ScrapingBee headers as attributes:

page = api.scrape("https://example.com")
page.cost          # Spb-cost, credits charged
page.auto_cost     # Spb-auto-cost, present only for auto() calls
page.request_id    # Spb-request-id, quote this in support requests
page.resolved_url  # Spb-resolved-url, the final URL after redirects

Errors

Non-2xx responses raise ScrapingBeeError, carrying the status, the body and the request id. HTTP 500 responses are not charged credits, so retrying on 500 is safe.

from web_scraping_api_sdk import ScrapingBeeAPI, ScrapingBeeError

try:
    page = api.scrape("https://example.com", stealth_proxy=True)
except ScrapingBeeError as error:
    print(error.status_code, error.request_id)

Scope

Public, pre-login pages only. Scraping behind login credentials is prohibited by the ScrapingBee terms. Keep your API key out of shared environments, including AI coding assistants.

Links

MIT licensed.

Download files

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

Source Distribution

web_scraping_api_sdk-0.1.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

web_scraping_api_sdk-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file web_scraping_api_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: web_scraping_api_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for web_scraping_api_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cec7c61f1c7b57818f5e662f6a076c6cee1c33dca46f317e3c5dea6402eb2f6d
MD5 8fde9f879db510db2d586b1c79f82553
BLAKE2b-256 37939a351e627b1eb8d465e6049157a68aee7c229862d51dd10279375b983d0c

See more details on using hashes here.

File details

Details for the file web_scraping_api_sdk-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for web_scraping_api_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eaeb223b498a7a8fa5f97c012a193cf7f7f8ef2c73d1677fd205c29c8bc55a48
MD5 f096c16c2a0c47a25f57185ffdb09ec9
BLAKE2b-256 dc97b53f3e25d3b077d9f8cd1ae7eef88347166fe1e015e354baf2e635b772da

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

2 files

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

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