Metadata-Version: 2.4
Name: duckduckgo-autoconsent-py
Version: 14.86.0
Summary: Pre-built DuckDuckGo autoconsent JS bundle for use with Playwright (no Node.js required)
Project-URL: Homepage, https://github.com/sedric-ai-labs/duckduckgo-autoconsent-py
Project-URL: Source, https://github.com/sedric-ai-labs/duckduckgo-autoconsent-py
Project-URL: Upstream npm, https://www.npmjs.com/package/@duckduckgo/autoconsent
License: MPL-2.0
License-File: LICENSE
Keywords: autoconsent,consent,cookie,duckduckgo,gdpr,playwright
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# duckduckgo-autoconsent-py

Pre-built [DuckDuckGo autoconsent](https://github.com/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

```bash
pip install duckduckgo-autoconsent-py
```

## Usage

```python
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.
