If an exception is raised in the synchronous api during the setup, super().__enter__ has been called but super().__exit__ will not get called, leading to asyncio runloop exceptions further down the line if one tries to create a new context. This commit catches the exception in order to clean up the super().__exit__ calls before reraising. |
||
|---|---|---|
| .. | ||
| camoufox | ||
| publish.sh | ||
| pyproject.toml | ||
| README.md | ||
Camoufox Python Interface
Lightweight wrapper around the Playwright API to help launch Camoufox.
Note
All the the latest documentation is avaliable here.
What is this?
This Python library wraps around Playwright's API to help automatically generate & inject unique device characteristics (OS, CPU info, navigator, fonts, headers, screen dimensions, viewport size, WebGL, addons, etc.) into Camoufox.
It uses BrowserForge under the hood to generate fingerprints that mimic the statistical distribution of device characteristics in real-world traffic.
In addition, it will also calculate your target geolocation, timezone, and locale to avoid proxy protection (see demo).
Installation
First, install the camoufox package:
pip install -U camoufox[geoip]
The geoip parameter is optional, but heavily recommended if you are using proxies. It will download an extra dataset to determine the user's longitude, latitude, timezone, country, & locale.
Next, download the Camoufox browser:
Windows
camoufox fetch
MacOS & Linux
python3 -m camoufox fetch
To uninstall, run camoufox remove.
CLI options
Usage: python -m camoufox [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
fetch Fetch the latest version of Camoufox
path Display the path to the Camoufox executable
remove Remove all downloaded files
server Launch a Playwright server
test Open the Playwright inspector
version Display the current version
Usage
All of the latest documentation is avaliable at camoufox.com/python.