Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a webpage through a hosted screenshot API in Python, install the provider’s SDK, load its credentials from environment variables, set the target URL and image options, then save the returned bytes to a file. The example below uses ScreenshotOne’s Python SDK; API syntax and available options vary by provider. If you would rather run the browser yourself, Playwright is a local alternative.

India does not change the basic Python workflow, but the official API and SDK documentation described here does not establish India-specific billing terms, execution regions, latency, data residency, or payment-method availability. Check the provider’s current terms if any of those affect your use case.

Capture a webpage with ScreenshotOne’s Python SDK

You need a ScreenshotOne account and its access key and secret key before making the request. The SDK returns image bytes as a stream, which you can copy directly to a file. This example saves a viewport capture as PNG:

  1. Install the SDK in your project’s active Python environment:

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    #1 Best Overall
    Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
    • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
    • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
    • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
    • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
    • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
    python -m pip install screenshotone
  2. Set the credentials in your environment rather than placing real keys in the script. For example, in a Unix-like shell:

    export SCREENSHOTONE_ACCESS_KEY='your-access-key'
    export SCREENSHOTONE_SECRET_KEY='your-secret-key'

    Use your operating system’s environment-variable settings or a secrets manager for other environments. Do not commit keys to source control.

    Rank #2
    Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
    • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
    • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
    • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
    • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
    • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
  3. Save this as capture.py and run it with Python:

    import os
    import shutil
    from screenshotone import Client, TakeOptions
    
    client = Client(
        os.environ["SCREENSHOTONE_ACCESS_KEY"],
        os.environ["SCREENSHOTONE_SECRET_KEY"],
    )
    options = (
        TakeOptions.url("https://example.com")
        .format("png")
        .viewport_width(1280)
        .viewport_height(800)
    )
    image = client.take(options)
    with open("screenshot.png", "wb") as output:
        shutil.copyfileobj(image, output)
    
    print("Saved screenshot.png")
    python capture.py

    If the request succeeds, screenshot.png is written in the current working directory. The SDK example above follows the provider’s documented usage pattern; adapt the URL and options to your task.

Choose the capture area and output

Decide whether you need only the visible browser viewport or the whole page, and choose a format that suits the next step in your workflow. ScreenshotOne documents viewport width and height, full-page capture, and PNG, JPEG, WebP, and PDF output. It accepts a URL, HTML, or Markdown as input. Consult the provider’s current options documentation for exact SDK method names and supported combinations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • Viewport capture: the example’s 1280-by-800 settings request a fixed viewport. Change the dimensions to fit the layout you need.
  • Full-page capture: use the provider’s full-page option when you need content beyond the initial viewport. This is different from increasing the viewport height, and the resulting image may be much taller.
  • Image or PDF: select the format expected by your consumer. PDF output is useful when the result is intended as a document rather than an image asset.
  • Emulated devices: a provider’s mobile viewport or device emulation is not a photograph of a physical phone. If actual-device pixel fidelity matters, validate the page on the target device and browser.

Keep credentials and requests safe

Treat access keys and secret keys like passwords. Keep them in environment variables or a secrets manager, do not commit them to a repository, and do not expose them in public pages or client-side code. Use HTTPS: plain HTTP can expose credentials, headers, cookies, and other sensitive request data in transit.

A signed screenshot URL can be appropriate when an application needs to share access to an image; it is not a reason to publish the secret key or pass it openly as a request parameter. Avoid logging full authenticated URLs or sensitive headers. For shared links, follow the provider’s signed-link guidance.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Handle failures instead of assuming every response is an image

Successful captures produce image bytes, but an API can return an error instead. ScreenshotOne documents errors for invalid options, internal problems, and usage limits. In production, catch the SDK or HTTP client’s errors, record a useful error category and request context, and avoid writing an error response into a file named .png.

  • Missing environment variable: Python raises a KeyError when the script reads a credential that is not set. Set the variable in the same shell or runtime that launches Python.
  • Authentication failure: confirm that both keys belong to the account and are copied correctly. Do not paste secrets into logs or support tickets.
  • Invalid option or request: check the target URL and option names against the current SDK/API documentation. SDK syntax is provider-specific; a parameter from another screenshot service may not be accepted.
  • Usage limit or service error: inspect the returned error and status through the SDK’s exception details, then check account limits or retry only where appropriate. Do not treat every failure as a transient network issue.
  • Unexpectedly small or incomplete capture: confirm whether the request used viewport or full-page mode, and whether the target page had finished rendering before capture.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use a hosted API or run Playwright locally?

A hosted API operates the browser and returns screenshot data through its endpoint. That can suit an integration where you want to make an API call rather than maintain browser processes. Playwright lets your Python program launch and control a browser in your own environment, which is useful when you need direct browser automation or prefer to manage that runtime yourself.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Consideration Hosted screenshot API Playwright
Who runs the browser? The provider operates the capture service. Your environment launches and controls the browser.
Account and credentials Requires a provider account and API credentials. Can run without a screenshot-service account; your environment must be set up to run Playwright.
Control Control is through the provider’s documented API and options. Python APIs provide browser automation, including viewport, page, and element screenshot workflows.
Operational work Integrate an endpoint and handle its responses. Install and operate browser software as part of your workflow.
India-specific execution or billing terms Not established by the official API and SDK pages consulted for this guide; confirm with the provider. Not applicable to a hosted screenshot API; your own deployment choices determine where your process runs.

Take a screenshot with Playwright instead

For a locally controlled browser workflow, Playwright’s Python API can save a page screenshot. Install Playwright and its browser binaries, then run a synchronous script such as:

python -m pip install playwright
python -m playwright install chromium
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(viewport={"width": 1280, "height": 800})
    page.goto("https://example.com", wait_until="networkidle")
    page.screenshot(path="screenshot.png", full_page=True)
    browser.close()

This launches Chromium in the environment where the script runs and saves a full-page PNG. Playwright also supports viewport screenshots, element screenshots, asynchronous use, and returning screenshot bytes for further processing. If you do not need full-page output, change full_page=True to full_page=False or omit it according to the API you use. A page that never reaches the selected load condition can delay or fail navigation; use a suitable wait condition for the site rather than assuming every page behaves alike.

Or skip the browser setup

ScreenshotNeo is a website screenshot API with an MCP server for AI agents. Its Python call requests a capture and writes the response body to a file:

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)

See the ScreenshotNeo API documentation for setup and request options. ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots. Every feature is on every plan. Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.