Skip to main content

Pre-built DuckDuckGo autoconsent JS bundle for use with Playwright (no Node.js required)

Project description

duckduckgo-autoconsent-py

Pre-built DuckDuckGo autoconsent JS bundle for use with Playwright — no Node.js required.

The JS assets are baked into the wheel at publish time. Installing this package gives you the bundle and CMP rules as Python strings, ready to inject into any Playwright page.

Installation

pip install duckduckgo-autoconsent-py

Usage

from duckduckgo_autoconsent import bundle, rules_json

# Inject into a Playwright page after navigation
await page.add_script_tag(content=bundle())
await page.evaluate(
    """(args) => new Promise(resolve => {
        window.__acResolve = resolve;
        window.autoconsentReceiveMessage({
            type: 'initResp',
            config: { autoAction: 'optOut' },
            rules: { autoconsent: JSON.parse(args.rules_json), consentomatic: {} }
        });
        setTimeout(() => resolve('timeout'), args.timeout_ms);
    })""",
    {"rules_json": rules_json(), "timeout_ms": 3000},
)

Versioning

The package version mirrors the bundled @duckduckgo/autoconsent npm version. duckduckgo-autoconsent-py==14.86.0 bundles @duckduckgo/autoconsent@14.86.0.

License

MPL-2.0 — same as the upstream autoconsent library.

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

duckduckgo_autoconsent_py-14.86.0.tar.gz (68.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

duckduckgo_autoconsent_py-14.86.0-py3-none-any.whl (68.2 kB view details)

Uploaded Python 3

File details

Details for the file duckduckgo_autoconsent_py-14.86.0.tar.gz.

File metadata

File hashes

Hashes for duckduckgo_autoconsent_py-14.86.0.tar.gz
Algorithm Hash digest
SHA256 2a74989d7f1295a19ce469726454d42bbd8c2fd2c1253da69daf261d8a9c9599
MD5 6549690710c6e03a481220c986457b0c
BLAKE2b-256 7a82d77e332445f1b870c5edfb248bdb5aae0db88f913eb89c3ca6add8219d76

See more details on using hashes here.

File details

Details for the file duckduckgo_autoconsent_py-14.86.0-py3-none-any.whl.

File metadata

File hashes

Hashes for duckduckgo_autoconsent_py-14.86.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f2376d5dcf18cff2bf3f123b4e9061d56938d99b876c4373af824db3973f0ed
MD5 f907fb12ab15bcddfa03825c2f6ce520
BLAKE2b-256 e159b427888c86dc0899a30a7309e067371eb384d18300d067883683af241905

See more details on using hashes here.

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