Easily make screenshots of web pages in any screen size, as any device
Browshot is an API to easily make screenshots of web pages in any screen size and as any device.
import requests
api_key = 'YOUR_API_KEY'
target_url = 'https://example.com'
params = {
'url': target_url,
'api_key': api_key,
'width': 1280,
'height': 800,
'instance_id': 'desktop_chrome' # Example: desktop_chrome, mobile_iphone
}
response = requests.get('https://api.browshot.com/api/v1/screenshot', params=params)
if response.status_code == 200:
# Assuming the API returns image data or a JSON with a URL to the image
# If it returns image data directly:
# with open('screenshot.png', 'wb') as f:
# f.write(response.content)
# If it returns JSON with image_url:
try:
print(response.json())
except ValueError:
print("Received non-JSON response, likely image data.")
else:
print(f"Error: {response.status_code}, {response.text}")Last 50 checks (10 min intervals)