Skip to main content

ScraperAPI Python SDK

Install

pip install scraperapi-sdk

Usage

from scraperapi_sdk import ScraperAPIClient

client = ScraperAPIClient("<API-KEY>")

# regular get request
content = client.get('https://amazon.com/')
# get request with premium
content = client.get('https://amazon.com/', params={'premium': True})

# post request
content = client.post('https://webhook.site/403e44ce-5835-4ce9-a648-188a51d9395d', headers={'Content-Type': 'application/x-www-form-urlencoded'}, data={'field1': 'data1'})

# put request
content = client.put('https://webhook.site/403e44ce-5835-4ce9-a648-188a51d9395d', headers={'Content-Type': 'application/json'}, data={'field1': 'data1'})

The content variable will contain the scraped page.

If you want to get the Response object instead of the content you can use make_request.


response = client.make_request(url='https://webhook.site/403e44ce-5835-4ce9-a648-188a51d9395d', headers={'Content-Type': 'application/json'}, data={'field1': 'data1'})
# response will be <Response [200]>

Exception


from scraperapi_sdk import ScraperAPIClient
from scraperapi_sdk.exceptions import ScraperAPIException

client = ScraperAPIClient(
    api_key=api_key,
)
try:
    result = client.post('https://webhook.site/403e44ce-5835-4ce9-a648-188a51d9395d', headers={'Content-Type': 'application/x-www-form-urlencoded'}, data={'field1': 'data1'})
    _ = result
except ScraperAPIException as e:
    print(e.original_exception)  # you can access the original exception via `.original_exception` property.

Structured Data Collection Methods

Amazon Endpoints

Amazon Product Page API

This method will retrieve product data from an Amazon product page and transform it into usable JSON.

result = client.amazon.product("<ASIN>")

result = client.amazon.product("<ASIN>", country="us", tld="com")

Read more in docs: Amazon Product Page API

Amazon Search API

This method will retrieve products for a specified search term from Amazon search page and transform it into usable JSON.

result = client.amazon.search("<QUERY>")
result = client.amazon.search("<QUERY>", country="us", tld="com")

Read more in docs: Amazon Search API

Amazon Offers API

This method will retrieve offers for a specified product from an Amazon offers page and transform it into usable JSON.

result = client.amazon.offers("<ASIN>")
result = client.amazon.offers("<ASIN>", country="us", tld="com")

Read more in docs: Amazon Offers API

Amazon Reviews API

This method will retrieve reviews for a specified product from an Amazon reviews page and transform it into usable JSON.

result = client.amazon.review("<ASIN>")
result = client.amazon.offers("<ASIN>", country="us", tld="com")

Read more in docs: Amazon Reviews API

Amazon Prices API

This method will retrieve product prices for the given ASINs and transform it into usable JSON.

result = client.amazon.prices(['<ASIN1>'])
result = client.amazon.prices(['<ASIN1>', '<ASIN2>'])
result = client.amazon.prices(['<ASIN1>', '<ASIN2>'], country="us", tld="com")

Read more in docs: Amazon Prices API

Release files for scraperapi-sdk 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scraperapi-sdk 1.1.0
File Size Uploaded
scraperapi_sdk-1.1.0.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scraperapi-sdk 1.1.0
File Interpreter ABI Platform
scraperapi_sdk-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / scraperapi_sdk-1.1.0.tar.gz

Download URL scraperapi_sdk-1.1.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
90ede6c4dca1da6ffdcd285600039929f322124b944e9aeea780e89d633e9096
BLAKE2b-256 checksum
How to use checksums
0310bfa60023f356d0dbd90ab3ee9463d36bb97a7d65ba74f7c6e953d5c6004b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.2 Darwin/23.4.0

Release files / scraperapi_sdk-1.1.0-py3-none-any.whl

Download URL scraperapi_sdk-1.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcbfcd6451764106ae3fac8b9f028d4536125ba9fd6151ccec0d3a1c78f9c609
BLAKE2b-256 checksum
How to use checksums
4dacdd393c11fcbd0be95f1b449909987aa989020ea4a637a58134fee0109aa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.2 Darwin/23.4.0

Release history Release notifications | RSS feed

1.6.1

2 release files

1.6.0

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page