Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ The bindings follow Lightpanda's development and the package version tracks
browser releases — there is no backwards-compatibility guarantee: when the
browser's tools change, the Python methods change with them.

A tool returning JSON gives you the parsed value — `extract` a dict, `links`
a list. `goto` and the actions answer with a sentence describing what they
did, which also carries where it left the page, so a 404 is a field rather
than something to find in prose:

```python
r = page.goto(url="https://example.com/missing")
print(r) # Navigated successfully. HTTP 404 Not Found.
if r.http_status >= 400:
raise SystemExit(f"{r.url} is an error page, not content")
```

## Examples

[`examples/`](examples/) scrapes a JavaScript-rendered site that `requests`
Expand Down
3 changes: 2 additions & 1 deletion lightpanda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@

from .async_browser import AsyncBrowser, AsyncSession, run_script_async
from .bidi import AsyncBiDiServer, BiDiServer
from .browser import Browser, Session, run_script
from .browser import Browser, PageResult, Session, run_script
from .cdp import AsyncCDPServer, CDPServer
from .errors import LightpandaError, ProcessError, ProtocolError, ScriptError, ToolError

__all__ = [
"Browser",
"Session",
"PageResult",
"run_script",
"AsyncBrowser",
"AsyncSession",
Expand Down
Loading
Loading