docs
Getting Started
Python

Getting Started with Our Python Client

Setup

In your project, install the get-scraping client:

pip install get-scraping

Usage

from get_scraping import GetScrapingClient, GetScrapingParams
from bs4 import BeautifulSoup
 
# Initialize the client
client = GetScrapingClient("YOUR_API_KEY")
 
# Set up scraping parameters
scrape_options = GetScrapingParams(
    url="https://example.com",
    method="GET"
)
 
# Perform the scrape
result = client.scrape(scrape_options)
 
# Use the result headers
headers = result.headers
 
# Verify you got the status code you're looking for
if result.status_code != 200:
    # Handle error
    pass
 
# Load the html and pull the data you need
soup = BeautifulSoup(result.text, 'html.parser')
 
page_title = soup.title.text if soup.title else ""
 
# Example of using JavaScript rendering options
js_scrape_options = GetScrapingParams(
    url="https://example.com",
    method="GET",
    js_rendering_options=JavascriptRenderingOptions(
        render_js=True,
        wait_for_selector="#dynamic-content"
    )
)
 
js_result = client.scrape(js_scrape_options)
 
# Example of using retry configuration
retry_scrape_options = GetScrapingParams(
    url="https://example.com",
    method="GET",
    retry_config=RetryConfig(
        num_retries=3,
        success_status_codes=[200],
        success_selector=".content-loaded"
    )
)
 
retry_result = client.scrape(retry_scrape_options)

See our python examples for more detailed usage.