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.91.0.tar.gz (69.1 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.91.0-py3-none-any.whl (68.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for duckduckgo_autoconsent_py-14.91.0.tar.gz
Algorithm Hash digest
SHA256 5e30d5716692a4f048b91a9349bdf899050f24fe6fafe38150b491ac47c36a7b
MD5 b779fcdf2ea7e368c9df3080dc671357
BLAKE2b-256 1dc8c64a1fc8e35dc58c45c07ecc3aeb8b47f588270802273ab604588dc49763

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for duckduckgo_autoconsent_py-14.91.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7630958ed45988d39345ae6075712b76d767336520da259fbae90d1f7d447ab2
MD5 f6dace76c73da4cd02b5810816fc4b4d
BLAKE2b-256 345fe1cd27d03080b11aff01a196baf00e9ed7603c64d689d2523c2d36a7633f

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