Wrapper around Playwright to help launch Camoufox
Project description
Camoufox Python Interface
This is the Python library for Camoufox.
[!WARNING] This is still experimental and in active development!
Installation
First, install the camoufox
package:
pip install -U camoufox
Then, download the Camoufox browser:
camoufox fetch
To uninstall, run camoufox remove
.
Usage
Camoufox is fully compatible with your existing Playwright code. You only have to change your browser initialization:
Sync API
from camoufox.sync_api import Camoufox
with Camoufox(headless=False) as browser:
page = browser.new_page()
page.goto("https://example.com/")
Async API
from camoufox.async_api import AsyncCamoufox
async with AsyncCamoufox(headless=False) as browser:
page = await browser.new_page()
await page.goto("https://example.com")
Parameters
Launches a new browser instance for Camoufox.
Parameters:
playwright (Playwright):
The playwright instance to use.
config (Optional[Dict[str, Any]]):
The configuration to use.
addons (Optional[List[str]]):
The addons to use.
fingerprint (Optional[Fingerprint]):
The fingerprint to use.
exclude_addons (Optional[List[DefaultAddons]]):
The default addons to exclude, passed as a list of camoufox.DefaultAddons enums.
screen (Optional[browserforge.fingerprints.Screen]):
The screen constraints to use.
os (Optional[ListOrString]):
The operating system to use for the fingerprint. Either a string or a list of strings.
user_agent (Optional[ListOrString]):
The user agent to use for the fingerprint. Either a string or a list of strings.
fonts (Optional[List[str]]):
The fonts to load into Camoufox, in addition to the default fonts.
args (Optional[List[str]]):
The arguments to pass to the browser.
executable_path (Optional[str]):
The path to the Camoufox browser executable.
**launch_options (Dict[str, Any]):
Additional Firefox launch options.
Config
Camoufox config data can be passed as a dictionary to the config
parameter:
from camoufox import Camoufox
with Camoufox(
config={
'webrtc:ipv4': '123.45.67.89',
'webrtc:ipv6': 'e791:d37a:88f6:48d1:2cad:2667:4582:1d6d',
}
) as browser:
page = browser.new_page()
page.goto("https://www.browserscan.net/")
BrowserForge Integration
Camoufox is fully compatible with BrowserForge.
By default, Camoufox will use a random fingerprint. You can also inject your own Firefox Browserforge fingerprint into Camoufox with the following example:
from camoufox.sync_api import Camoufox
from browserforge.fingerprints import FingerprintGenerator
fg = FingerprintGenerator(browser='firefox')
# Launch Camoufox with a random Firefox fingerprint
with Camoufox(fingerprint=fg.generate()) as browser:
page = browser.new_page()
page.goto("https://www.browserscan.net/")
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
camoufox-0.1.0b0.tar.gz
(19.0 kB
view hashes)
Built Distribution
camoufox-0.1.0b0-py3-none-any.whl
(21.6 kB
view hashes)
Close
Hashes for camoufox-0.1.0b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42169cf1927cae5d153cc4849b9bd7eaba89bacabf57a10fa5e41359cebf4d64 |
|
MD5 | fe82a94f10ecd2efebe06a9fb54231fc |
|
BLAKE2b-256 | cf1f96ac98e1ef1379f01341796efe2b44a615ef337055468515c2f6136be059 |