How to Take a Screenshot of a URL using Python

Rendering an image of a website’s home page serves a variety of uses. Chiefly, it’s an easy way to store images of how your website & various accounts appear to the average page visitor. To gather website screenshots efficiently, you can leverage our URL Screenshot API as a built-in service for your application or website. It will simply generate a full-page screenshot PNG image of the website in question and return the file for use in whichever way you see fit.

Below, I’ll demonstrate how you can easily structure your API in Python using ready-to-run code examples.

Let’s start by installing the Python SDK. Run the following command:

Next, let’s copy in the imports:

After that, copy the remaining code to call the function. You’ll need a Cloudmersive API key to authenticate within the first snippet (you can get one easily by registering a free account on our website).

With that, you’re all done — no more coding required.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.