Free tools Windows power users keep installed
One-click scans. No signup required.
To return a website screenshot from Flask, have the route validate a requested URL, call a screenshot service from the server with an API key and bounded timeout, then return the image bytes with the matching Content-Type. Flask does not render the remote page in this hosted-API setup; it acts as a secure bridge between your client and the rendering provider.
Build a Flask screenshot endpoint with the ScreenshotAPI SDK
This quick start follows ScreenshotAPI’s documented Python SDK pattern. The package distribution is screenshotapi-to, and the import is ScreenshotAPI from screenshotapi. SDK names and response objects are provider- and version-specific, so check the current SDK documentation before deploying.
1. Install the dependencies and configure the key
In a virtual environment, install Flask and the SDK:
python -m pip install Flask screenshotapi-to
Set the key outside your source code. For example, on macOS or Linux:
#1 Best Overall
- 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.
export SCREENSHOTAPI_KEY='your-provider-key'
Use your platform’s secret configuration for deployment rather than committing a real key to a repository. ScreenshotAPI’s Python SDK documentation advises keeping API keys on the server, not exposing them in browser bundles or mobile apps.
2. Add a route that returns the image bytes
import os
from flask import Flask, Response, jsonify, request
from screenshotapi import ScreenshotAPI
app = Flask(__name__)
api_key = os.environ.get("SCREENSHOTAPI_KEY")
if not api_key:
raise RuntimeError("Set SCREENSHOTAPI_KEY before starting the app")
client = ScreenshotAPI(api_key)
@app.get("/screenshot")
def screenshot():
url = request.args.get("url", "").strip()
if not url:
return jsonify(error="url is required"), 400
try:
result = client.screenshot({"url": url, "type": "webp"})
except Exception:
app.logger.exception("Screenshot provider request failed")
return jsonify(error="screenshot could not be created"), 502
return Response(result.image, mimetype=result.content_type)
if __name__ == "__main__":
app.run(debug=False)
Run the application and request a capture, URL-encoding the target as needed:
python app.py
curl --get 'http://127.0.0.1:5000/screenshot' --data-urlencode 'url=https://example.com' -o page.webp
The response is binary image data, not an HTML page. The route uses the content type returned by the SDK instead of assuming that every response is WebP. The example catches broadly to keep provider details and tracebacks out of the client response; in a production application, replace that broad catch with the SDK’s typed exceptions and map known failures to controlled statuses.
Use direct HTTP when you do not want the SDK
ScreenshotAPI’s Flask integration guide also demonstrates calling its endpoint with Python’s requests library, using an x-api-key header, capture dimensions and an image type. That is a separate provider-specific contract: do not assume another screenshot service uses the same header, fields, endpoint, or response semantics.
Rank #2
- 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.
A defensive outline for a direct request is below. Replace the endpoint and parameter names only with the exact values in your provider’s current documentation. No literal ScreenshotAPI endpoint URL or exact dimension parameter names are provided, so this is a pattern rather than copy-and-run vendor code.
import os
import requests
from flask import Flask, Response, jsonify, request
app = Flask(__name__)
API_KEY = os.environ["SCREENSHOTAPI_KEY"]
API_ENDPOINT = os.environ["SCREENSHOTAPI_ENDPOINT"]
@app.get("/screenshot-http")
def screenshot_http():
url = request.args.get("url", "").strip()
if not url:
return jsonify(error="url is required"), 400
try:
upstream = requests.get(
API_ENDPOINT,
headers={"x-api-key": API_KEY},
params={"url": url, "type": "webp"},
timeout=(5, 60),
)
except requests.Timeout:
app.logger.warning("Screenshot provider timed out")
return jsonify(error="screenshot provider timed out"), 504
except requests.RequestException:
app.logger.exception("Could not reach screenshot provider")
return jsonify(error="screenshot provider unavailable"), 502
if not upstream.ok:
app.logger.warning("Screenshot provider returned status %s", upstream.status_code)
return jsonify(error="screenshot provider rejected the request"), 502
content_type = upstream.headers.get("Content-Type", "").split(";", 1)[0]
if content_type not in {"image/png", "image/jpeg", "image/webp"}:
app.logger.warning("Unexpected provider content type: %s", content_type)
return jsonify(error="provider returned an unexpected content type"), 502
return Response(upstream.content, mimetype=content_type)
Here API_ENDPOINT is deliberately configuration rather than an invented vendor URL. Configure a connection timeout and a read timeout appropriate to the provider and your web server. The tuple in this example means the client will not wait indefinitely, but tune those values against the service’s documented behavior and your own request budget.
Validate the URL and constrain the capture
A screenshot endpoint can cause a rendering service to fetch a URL supplied by an end user. This creates abuse and server-side request forgery (SSRF) concerns in addition to ordinary input validation. Checking that a parsed URL begins with HTTP or HTTPS is a useful first filter, not a complete security boundary. The renderer’s network controls, the destinations you permit, and your application’s access policy all matter.
Apply a policy that fits your endpoint
- Prefer an allowlist of domains when the product only needs screenshots of known sites. Reject other hosts before making the provider call.
- Require authentication or rate-limit callers if captures can incur usage, expose private data, or be abused for scanning. Flask-Limiter is one rate-limiting option mentioned in the provider’s integration guidance; choose limits based on your own users and service limits.
- Restrict capture options. Accept only supported formats and bounded viewport dimensions, and cap output size if your provider or application permits it.
- Keep secrets and diagnostics private. Never send the API key to the browser or include it in logs. Log enough context to investigate provider failures, but avoid logging credentials or sensitive URLs unnecessarily.
- Review destination controls. Ask what internal, local, or otherwise restricted addresses the rendering service can reach and what protections it applies. A URL parser alone cannot answer that.
If your route renders any user-provided value into HTML, escape it as Flask’s Quickstart requires. Returning image bytes avoids building an HTML page from the supplied URL, but it does not remove the need to constrain what the screenshot service is asked to fetch.
Rank #3
- 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.
Choose output format, viewport and wait behavior
Screenshot settings affect fidelity, response size and latency. Use the option names supported by the provider you selected; parameters are not interchangeable across vendors.
Format
- PNG preserves pixels without lossy compression and is a sensible choice when exact edges or text rendering matter, at the cost of potentially larger files.
- JPEG is lossy and may be suitable for photographic pages when smaller output is more important than pixel-perfect edges.
- WebP can provide a compact image format, subject to support in the clients that consume it.
- PDF is for document-like output rather than an image response. Confirm that the provider’s PDF endpoint returns PDF bytes and set
application/pdfrather than an image MIME type.
Return the actual MIME type corresponding to the received bytes. Do not label a PDF as WebP or trust a caller-supplied content type without checking it against the provider response.
Viewport and full-page captures
Set width and height explicitly when you need repeatable captures; relying on provider defaults can make results vary if those defaults change. A viewport screenshot captures the visible region, while a full-page option is useful for long pages but can increase processing time and output size. Some pages reveal images only as they are scrolled, so use a provider’s lazy-image loading option where available.
Dynamic pages and wait conditions
A page’s initial load event may happen before client-side content appears. Waiting for a known selector, a short delay, or network idle can improve the result, but each wait can increase latency and a network-idle condition may not suit pages with continuing background requests. Pick the narrowest wait that reliably corresponds to the content you need.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #4
- 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
Make the route safer and more reliable in production
Use provider timeouts and typed failures
The ScreenshotAPI SDK documentation describes synchronous and asynchronous methods, a configurable timeout with a documented default of 60 seconds, and typed exceptions for authentication, credit, rendering and network failures. Verify behavior for the installed SDK version. Handle these categories separately: invalid input is a client error, authentication or quota problems are provider/configuration failures, and upstream timeout or render failure is not a successful image response. Return a controlled status and log details on the server.
Choose synchronous work or a background job
A synchronous route is simplest when captures are infrequent and complete within your application’s request budget. For long-running captures, bursts, or jobs that should continue after a client disconnects, enqueue work and store the result in durable storage; return a job identifier and provide a separate way to retrieve status or output. There is no universal traffic threshold at which you must switch: base the decision on observed latency, your worker capacity and the timeout limits of your web server and clients.
Cache carefully
If identical requests can reuse a capture, cache the result with a deliberate expiry. The cache key must include the target URL and every setting that changes the rendering, such as viewport, format, full-page mode, wait condition, headers or user agent. Exclude secret values from externally visible cache keys. Decide whether user-specific cookies or authorization headers make a capture private; such results should not be shared across callers.
Control output and usage
Set a maximum response size where possible, and avoid returning arbitrarily large captures through a route designed for small images. Apply caller limits and monitor provider usage so a public endpoint cannot silently consume your quota. When output is stored, define retention and access rules for screenshots that may contain personal or account information.
Recommended Free Tools
Best Value
- 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.
Hosted screenshot API or local browser?
| Approach | What it simplifies | What you take on |
|---|---|---|
| Hosted API called by Flask | No browser runtime to install and operate in your Flask deployment. | Provider dependency, server-side credentials, network latency, usage limits and possible cost. |
| Local Playwright or Selenium | More direct control over browser setup and rendering behavior. | Browser installation and updates, resource management, concurrency, and operational handling of failures. |
Neither approach is universally better. A hosted service fits a lightweight endpoint when outsourcing rendering is acceptable; local automation may fit an environment that needs tighter control and can operate browser infrastructure reliably.
Troubleshoot common failures
| Symptom | Likely cause | What to check |
|---|---|---|
| Flask returns 400 | The request omitted url or application policy rejected it. |
Send a URL parameter, encode it correctly, and check the route’s scheme/domain rules. |
| Provider authentication error | The key is missing, incorrect, revoked, or sent in the wrong place. | Check server secret configuration and the provider’s required header or SDK initialization. Do not print the key in logs. |
| Quota or credit failure | The provider account has no available allowance or billing is not configured. | Review the provider account’s usage and plan, then return a controlled upstream error to the caller. |
| 504 or client timeout | The target is slow, the render wait is too long, or the timeout budget is shorter than capture time. | Inspect server-side timing, use a bounded but sufficient provider timeout, simplify waits, or move slow captures to a background job. |
| Blank or incomplete image | The page blocks automated access, content is dynamically rendered, or capture occurred too early. | Check the provider’s render status, wait for a relevant selector, and confirm that the target is accessible to the rendering service. |
| Browser shows broken image or downloads the wrong file | The response MIME type does not match its bytes, or the route returned JSON error content. | Inspect status and Content-Type; return the provider’s verified image type only after confirming success. |
| Unexpected provider details appear to users | The route relays raw upstream error text. | Return a generic, stable error to clients and keep sanitized diagnostics in server logs. |
Or skip the browser setup
ScreenshotNeo is a hosted website screenshot API and MCP server. Its single-request API avoids operating a browser runtime in your Flask deployment; clean shots remove cookie/consent banners, newsletter popups and chat widgets before capture. Bot checks, blank pages and failed loads are not billed, and responses identify the page verdict and billing status in headers. Its MCP server gives AI agents tools to take screenshots, inspect page info and capture PDFs.
Here is a one-call Python request you can make from a Flask server or another Python service:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
For a Flask route, use the same request from the route and return the response bytes with the provider’s response content type, checking the status and failure headers before relaying the result. Keep the key on the server. See the ScreenshotNeo API documentation for request parameters and response handling.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesScreenshotNeo’s free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up free for ScreenshotNeo.
Frequently Asked Questions
Does Flask take the screenshot itself in this example?
No. Flask sends a server-side request to a rendering service and relays its binary response.
Can I use ScreenshotAPI SDK parameter names with another provider?
No. SDKs, endpoint URLs, authentication and capture options are provider-specific; use the selected service’s current documentation.
When should a screenshot request become a background task?
Move work off the request path when capture latency, bursts or client timeouts make synchronous handling unsuitable; there is no universal traffic cutoff.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Quick Recap
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.

