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

To capture a web page with ScreenshotMachine in Python, send an HTTP GET request to its screenshot endpoint with your customer key, target URL, and any capture options you need, then save the response as an image. ScreenshotMachine’s official Python example builds the request URL with its helper and saves the result with urllib.request.urlretrieve.

Set up ScreenshotMachine access

  1. Create or use a ScreenshotMachine account and find your customer key in the account profile.
  2. Keep the key out of publicly shared source code. If you have configured a secret phrase, do not expose it in public client-side code either.
  3. Choose the web page URL and the capture options you need. ScreenshotMachine documents an HTTP GET endpoint at https://api.screenshotmachine.com/; the page URL should be percent-encoded when placed in the query string. ScreenshotMachine API documentation

Use the official Python example pattern

The vendor’s Python repository uses a helper to construct the API URL and then retrieves that URL to a local file. The sample depends on the helper and its imports; include the repository’s helper implementation in your project rather than assuming the function is built into Python. ScreenshotMachine Python repository

import urllib.request

# Import or define generate_screenshot_api_url using the helper
# implementation in ScreenshotMachine's Python repository.
customer_key = "YOUR_CUSTOMER_KEY"
secret_phrase = ""  # Use your configured secret phrase, if applicable.
options = {
    "url": "https://example.com",
    "dimension": "1366x768",
    "device": "desktop",
    "cacheLimit": "0",
    "delay": "200",
    "zoom": "100",
}

api_url = generate_screenshot_api_url(customer_key, secret_phrase, options)
output_file = "output.png"
urllib.request.urlretrieve(api_url, output_file)
print(f"Saved screenshot to {output_file}")

This follows the shape of the vendor’s example; it is not a tested integration report, and the helper’s import or implementation must come from the linked repository. The output filename extension should match the format requested: PNG in this example. ScreenshotMachine’s API documentation lists JPG, PNG, and GIF formats.

Build the request and protect credentials

The API requires key for the customer API key and url for the page to capture. The Python helper takes the customer key separately and builds the URL from the options dictionary. If you build a request yourself, encode query values correctly, especially the target URL and values containing reserved characters.

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.

ScreenshotMachine documents an optional hash for accounts with a configured secret phrase: it is an MD5 digest of the URL value concatenated with the secret phrase. According to the vendor, requests with a missing or incorrect hash are ignored when a secret phrase is configured. Use the vendor’s documented signing behavior, and keep the secret phrase on a trusted server rather than in public HTML or browser code. API authentication details

Choose capture options

The options below are vendor-documented request parameters and defaults, not independent measurements of capture performance.

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.
Option What it controls Documented values or default
dimension Viewport width and height, or full-page height [width]x[height]; width 100–1920 px, height 100–9999 px; full is accepted for full-page height. Default: 120x90.
device Device profile desktop, phone, or tablet. Default: desktop.
format Image file type jpg, png, or gif. Default: jpg.
cacheLimit How long a cached screenshot may be reused 0–14 days; default 14. Use 0 to request a fresh screenshot. Decimal values are documented for sub-day periods.
delay Wait before capture 0–10,000 ms in documented increments; default 200 ms. Vendor guidance recommends a longer wait, such as 2,000 ms or more, for full-page captures with images or animations.
zoom Screenshot zoom percentage 10–400%; default 100. The vendor notes it may be ignored for screenshots smaller than typical device dimensions.
click Click a matching CSS selector before capture CSS selector; the API documentation gives dismissing a cookie banner as an example.
selector Capture a selected DOM element CSS selector.
cookies Supply cookies for the page Percent-encode values containing reserved characters.
accept-language Set the page’s language header Percent-encode values containing reserved characters.
user-agent Set the browser user-agent header Percent-encode values containing reserved characters.
crop Crop to a pixel region x,y,width,height.

Match the dimensions to the task

Use a width and height that resemble the viewport you want to document. Choose a device profile when the intended rendering is desktop, phone, or tablet. Use full for a page-length capture rather than a viewport-only image.

Balance freshness and rendering time

Set cacheLimit to 0 when the capture must be fresh; a longer cache window can reuse a prior result. Increase delay when a page needs additional time to display images or animation, particularly in full-page captures. Longer waits can increase how long the request takes; the documentation specifies the allowed delay range, not a guaranteed completion time.

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.

Save and check the output

urlretrieve writes the returned content to the filename you provide. Match the extension to the requested format—for example, use output.png when setting format to png. The vendor’s sample prints the saved filename and describes the file as being written to the current directory. The API documentation does not establish behavior for every site or provide independent latency, uptime, or error-rate results, so verify the saved file and target-specific output in your own workflow.

Troubleshoot common request problems

  • The request is ignored when a secret phrase is configured: Check that the account’s phrase and the URL value used to create the documented MD5 hash match the API settings. The vendor says missing or incorrect hashes are ignored in that configuration.
  • The target URL or cookie value is malformed: Percent-encode the page URL and values containing reserved characters before placing them in GET query parameters.
  • The screenshot cuts off the page: Use dimension with full for full-page height instead of a fixed viewport height.
  • Images or animations are missing in a full-page shot: Increase delay; the vendor recommends considering 2,000 ms or more for such captures.
  • The image type does not match the saved filename: Set format explicitly and use the corresponding extension, such as .jpg, .png, or .gif.
  • The output appears cached: Set cacheLimit to 0 to request a fresh screenshot instead of a cached one.

Or skip the browser setup:

If your goal is simply to get a screenshot from Python, ScreenshotNeo accepts a URL in one GET request and returns an image or PDF. Its cleanup can accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. It also has an MCP server with screenshot tools for AI agents. ScreenshotNeo

Python:

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 request options. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Can I use a full-page capture with ScreenshotMachine?

Yes. Set the documented dimension value to full for full-page height.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Does ScreenshotMachine’s Python example use a built-in Python function to create the API URL?

No. It relies on the vendor’s helper implementation in its Python repository; import or define that helper when adapting the sample.

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.

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.