Playwright-based browser automation service with HTTP API and Docker support
Project description
:performing_arts: browsy
browsy is a lightweight queue system for browser automation tasks. It lets you easily schedule and run operations like screenshots, PDF generation, and web scraping through a simple HTTP API - all without external dependencies.
Getting Started
The simplest way to spin browsy up is with Docker Compose. Check out the documentation for all the details, but below is the quick and easy way to jump right in.
Here's what you need to do:
- Install browsy
- Copy docker-compose.yml
- Define jobs
- Run docker compose
- That's it! Just send requests to queue jobs and grab their results when they're done
Quick Start
Install browsy
pip install browsy
Copy docker compose
git clone ...
Define a job
jobs/screenshot.py:
from browsy import BaseJob, Page
class ScreenshotJob(BaseJob):
NAME = "screenshot"
url: str | None = None
html: str | None = None
full_page: bool = False
async def execute(self, page: Page) -> bytes:
if self.url:
await page.goto(self.url)
elif self.html:
await page.set_content(self.html)
return await page.screenshot(full_page=self.full_page)
async def validate_logic(self) -> bool:
# Ensure only one target is given, never both
if bool(self.url) == bool(self.html):
return False
return True
In this example url, html and full_page are fields from Pydantic's BaseModel. They are used for new jobs validation.
Run browsy
docker compose up --build
That's it!
Using browsy
Trigger a job execution:
from browsy import BrowsyClient
client = BrowsyClient("http://127.0.0.1")
job_id = client.add_job("screenshot", {"url": "https://broton.dev", full_page=True})
screenshot = client.get_result(job_id=job_id).content
Architecture
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file browsy-0.0.1.tar.gz.
File metadata
- Download URL: browsy-0.0.1.tar.gz
- Upload date:
- Size: 207.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ddd0500ab4bf5d61544fddcfdac199d70fe26cea2f955f736e38f0c7180eae7
|
|
| MD5 |
e61c47a8bd7f730692a8732fa00a75ff
|
|
| BLAKE2b-256 |
ce88f049ecc69bd8bf3978f18cbf716bde3e8bbdd97a4cafe8bf226ceb767744
|
Provenance
The following attestation bundles were made for browsy-0.0.1.tar.gz:
Publisher:
publish-pypi-docker.yml on mbroton/browsy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
browsy-0.0.1.tar.gz -
Subject digest:
5ddd0500ab4bf5d61544fddcfdac199d70fe26cea2f955f736e38f0c7180eae7 - Sigstore transparency entry: 158113252
- Sigstore integration time:
-
Permalink:
mbroton/browsy@732c04e37784e7095034134c8e98ed36804039aa -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/mbroton
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi-docker.yml@732c04e37784e7095034134c8e98ed36804039aa -
Trigger Event:
release
-
Statement type:
File details
Details for the file browsy-0.0.1-py3-none-any.whl.
File metadata
- Download URL: browsy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aab0fdd0799ebb2c82175e801273b28e866b545cd36a45dc4a077d05beb5eafc
|
|
| MD5 |
cf400bcb008dba3c7a0401fc006545e5
|
|
| BLAKE2b-256 |
d2d1663bd5d739ce8690fd4f5e16263d7c112f93eb68a789ab4e56fed9912029
|
Provenance
The following attestation bundles were made for browsy-0.0.1-py3-none-any.whl:
Publisher:
publish-pypi-docker.yml on mbroton/browsy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
browsy-0.0.1-py3-none-any.whl -
Subject digest:
aab0fdd0799ebb2c82175e801273b28e866b545cd36a45dc4a077d05beb5eafc - Sigstore transparency entry: 158113253
- Sigstore integration time:
-
Permalink:
mbroton/browsy@732c04e37784e7095034134c8e98ed36804039aa -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/mbroton
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi-docker.yml@732c04e37784e7095034134c8e98ed36804039aa -
Trigger Event:
release
-
Statement type: