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.84.0 bundles @duckduckgo/autoconsent@14.84.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.84.0.tar.gz (68.0 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.84.0-py3-none-any.whl (67.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for duckduckgo_autoconsent_py-14.84.0.tar.gz
Algorithm Hash digest
SHA256 820ada2fd6c3c902c99991354257289e0f190b2acf94e1995101dc95ce71ce92
MD5 dcd19a5c7cd20d49908653154d386344
BLAKE2b-256 0022520de86a55c9670afda2ac2b6828c35fdd83b99bd3856abc57b9c6ff3cf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for duckduckgo_autoconsent_py-14.84.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ed8d3510047d97ca3082d2fb88698d0a93b68643e31f28755d9c337d5731f16
MD5 e45c3489d9b2e5810a39ca842de77f2e
BLAKE2b-256 b451394edfa78fe42908e3dc352707f5b721aab18ae3f83be1025a4d3a7b0e98

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