Browshot version 2.0.0
================================
Browshot captures web pages as screenshots, PDFs, and videos. The Python client supports both API v1 and v2.
Install from PyPI with python3 -m pip install Browshot. Install from this checkout with python3 -m pip install .
Python 3.9 or newer is required. pip installs the requests dependency.
API 2.0
from browshot import BrowshotClient
import os
client = BrowshotClient(os.environ['BROWSHOT_API_KEY'])
capture = client.screenshot_create('https://example.com/', {
'browser': 'brave',
'country': 'fr',
'screen_width': 1280,
'screen_height': 720,
})
Existing options such as instance_id, details, priority, hosting, and hooks
select v1. Use browser, country, and a device or viewport dimensions for v2.
An explicit API base URL sets the client default. Pass api_version in a
request's parameters to select a specific version.
screenshot_info and thumbnail downloads prefer v2 and accept IDs created
through either version. Set details or api_version=1 when you need the v1
screenshot metadata. The browser catalog and numeric browser IDs use v1 by
default to retain the legacy catalog fields. Use browser_info('brave') or
browser_list({'api_version': 2}) to look up the v2 browsers.
Use device_list to find device keys, tag_list to list your capture tags, and
batch_download to retrieve the ZIP bytes for a finished batch. app_create and
the other app methods manage v2 delivery destinations. Use simple or
simple_file for a synchronous screenshot.
API v1 reference
https://browshot.com/api/documentation/
API v2 reference
https://browshot.com/api/documentation-v2/
Source
https://github.com/juliensobrier/browshot-python
Tests
python3 -m unittest discover -s tests -p '*_test.py'
Set BROWSHOT_API_KEY to enable live checks with your account. Set
BROWSHOT_SCREENSHOT_ID to a finished capture and BROWSHOT_RETINA_ID to a
finished capture with retina and ad blocking. For artifact checks, set
BROWSHOT_PDF_ID, BROWSHOT_WEBM_ID, BROWSHOT_MP4_ID, and BROWSHOT_GIF_ID to
owned, finished captures of each format.
API 1.32
from browshot import BrowshotClient
import os
client = BrowshotClient(os.environ['BROWSHOT_API_KEY'])
capture = client.screenshot_create('https://example.com/', {
'instance_id': 373,
'pdf': 1,
'pdf_format': 'a4',
'pdf_margin': '10mm',
'device_scale': 2,
'hide_ads': 1,
})
Poll screenshot_info(capture['id']) until status is 'finished'. Download with
screenshot_pdf(capture['id']) or save with
screenshot_pdf_file(capture['id'], 'example.pdf').
PDF settings include pdf_format (letter, a4, or legal), pdf_background,
pdf_landscape, pdf_one_page, pdf_margin, and the per-side pdf_margin_top,
pdf_margin_bottom, pdf_margin_left, and pdf_margin_right.
Request a short video or animated GIF with the same capture method.
recording = client.screenshot_create('https://example.com/', {
'instance_id': 373,
'video': 1,
'video_format': 'gif',
'video_duration': 5,
'video_scale': 0.5,
})
After the capture finishes, use screenshot_video(recording['id']) to get the
bytes or screenshot_video_file(recording['id'], 'example.gif') to save them.
Accepted formats are webm (default), mp4, and gif. Set video_duration to 1–30
seconds, video_quality to 0–63, video_fps to 1–30, and video_scale to 0.1–1.
GIF uses 20 fps. An MP4 request can produce WebM where MP4 encoding is unavailable.
The download methods return bytes or b'' on failure. File helpers use the
supplied path in an existing directory and return that path, or '' on failure.
Downloads preserve the returned bytes.
Choose a capture country through instance_id. The IDs below are in order
Chrome, Firefox, iPhone 12, and Samsung S20.
France 373 374 375 376
India 377 378 379 380
Finland 381 382 383 384
United Kingdom 385 386 387 388
Each new instance costs one credit before options. PDF adds one credit per
capture. Recording adds one credit per started five seconds of requested
duration. Both require a paid Chrome-based instance, and video requires
device_scale=1. Retina (device_scale=2), ad blocking (hide_ads=1), and downloads
add no credits.
Metadata
Release files for Browshot 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| browshot-2.0.0.tar.gz | 8.6 kB | Without provenance | Details for browshot-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| browshot-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for browshot-2.0.0-py3-none-any.whl |
Total release size: 17.0 kB
Release files / browshot-2.0.0.tar.gz
| Download URL | browshot-2.0.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05a682af7dd6901323e9706e0ee2b4b533b67b88ff8695225009efa3315d1d3a
|
|
BLAKE2b-256 checksum How to use checksums |
2fce108a5c99eae6b047e1e91e6ef31d8c0cfd2a3842face7a59bf688e0996ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / browshot-2.0.0-py3-none-any.whl
| Download URL | browshot-2.0.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4973106024aec74b2d8f8528c7305eab73ef8495ac143b0feedf414efa5057b6
|
|
BLAKE2b-256 checksum How to use checksums |
e4deefbce81352322e7faadc23b69b677d882eb3b4d5a5494e7eb0b1d56e042a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Security for Browshot 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.