Python wrapper for Lightpanda browser with CDP server and Playwright integration for lightweight web scraping and automation
Project description
lightpanda-py
Python bindings for Lightpanda, a fast headless browser for AI agents and web automation.
Installation
pip install lightpanda-py
# or
uv add lightpanda-py
Usage
Quick fetch
import lightpanda
response = lightpanda.fetch("https://example.com")
print(response.text)
# JSON APIs
response = lightpanda.fetch("https://httpbin.org/ip")
data = response.json()
CDP Server
Start a CDP server to use with Playwright, Puppeteer, or any CDP client:
import lightpanda
proc = lightpanda.serve(host="127.0.0.1", port=9222)
# 🐼 Running Lightpanda's CDP server... { pid: 12345 }
# Connect with your favorite CDP client...
proc.kill()
With Playwright:
import lightpanda
from playwright.sync_api import sync_playwright
proc = lightpanda.serve()
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp("http://127.0.0.1:9222")
page = browser.new_page()
page.goto("https://example.com")
print(page.content())
browser.close()
proc.kill()
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lightpanda_py-0.1.0.tar.gz
(3.2 kB
view details)
File details
Details for the file lightpanda_py-0.1.0.tar.gz.
File metadata
- Download URL: lightpanda_py-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15cd27b2298b546144f4a776bc91f9b996e5f7c3375bffafc494f01794add8cd
|
|
| MD5 |
a021ba73950eefc377d7d29919425ff0
|
|
| BLAKE2b-256 |
1dcf1d93b04ae6d6cbc1faab9e4c00133a95c8393969365902a2432ad1cc851f
|
Provenance
The following attestation bundles were made for lightpanda_py-0.1.0.tar.gz:
Publisher:
publish.yml on tclesius/lightpanda-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightpanda_py-0.1.0.tar.gz -
Subject digest:
15cd27b2298b546144f4a776bc91f9b996e5f7c3375bffafc494f01794add8cd - Sigstore transparency entry: 812005989
- Sigstore integration time:
-
Permalink:
tclesius/lightpanda-py@bb31d8195623ff07cd9a4c24eb10979cfdaba79e -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tclesius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb31d8195623ff07cd9a4c24eb10979cfdaba79e -
Trigger Event:
release
-
Statement type: