ClearshotAPI

How to take URL screenshots with Python

python

Taking a screenshot of a website/URL using Python is simple. You can make the request in the Clearshot screenshot API using the Python “requests” module. 

In the headers, you pass through your Clearshot access token, and set the content type for the relevant response type you want to receive. In the example below, we want a json response. Passing the URL and the json parameter in the body payload will take a screenshot of the URL and return a json formatted response containing the screenshot resource and any other relevant information. 

For further documentation, parameters and error codes, you can check out the full documentation here

				
					import requests
import json

headers = {
  "Authorization": "Bearer [-- YOUR ACCESS TOKEN HERE --]",
  "Accept": "application/json"
}
payload = {
  "url": "https://apple.com",
  "json": "true"
}

url = 'https://app.clearshotapi.com/api/screenshot'

response = requests.post(url, headers = headers, params = {}, data = json.dumps(payload))

response.raise_for_status()
response.json()
				
			
Ready to get started?
Share on whatsapp
Share on email
Share on linkedin
Share on facebook
Share on twitter