Skip to main content

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


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)

Uploaded Source

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

Hashes for lightpanda_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15cd27b2298b546144f4a776bc91f9b996e5f7c3375bffafc494f01794add8cd
MD5 a021ba73950eefc377d7d29919425ff0
BLAKE2b-256 1dcf1d93b04ae6d6cbc1faab9e4c00133a95c8393969365902a2432ad1cc851f

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightpanda_py-0.1.0.tar.gz:

Publisher: publish.yml on tclesius/lightpanda-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page