Skip to main content

A Python implementation of the IAB consent strings (v1.1 and v2)

Project description

iab-tcf

Build Status codecov Codacy Badge Releasing Documentation Status

A Python implementation of the IAB consent strings (v1.1 and v2)

Installing

Install and update using pip:

pip install -U iab-tcf

Documentation

Documentation of this package can be found at readthedocs.io.

To generate the documentation locally:

pip install sphinx sphinx_rtd_theme
cd docs/
sphinx-apidoc -f -o . ../iab_tcf/
make html

A Simple Example

In order to decode a v1.1 or v2 consent string automatically we can do:

from iab_tcf import decode

consent = decode("CO5VTlWO5VTlWH1AAAENAwCwAIAAAAAAAIAAAAoAAAAA.YAAAAAAAAAA")

print(consent.version) # prints 2

If we want to improve performance and we already know it's going to be a v2 consent string we can do:

from iab_tcf import decode_v2

consent = decode_v2("CO5VTlWO5VTlWH1AAAENAwCwAIAAAAAAAIAAAAoAAAAA.YAAAAAAAAAA")

print(consent.version) # prints 2

Tests

In order to run the tests locally we can do:

pip install -r requirements-test.txt
pytest -v .

Thanks

Many thanks to LiveRamp/iabconsent which greatly inspired this project, and forms the basis and internal logic.

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

iab-tcf-0.2.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

iab_tcf-0.2.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file iab-tcf-0.2.1.tar.gz.

File metadata

  • Download URL: iab-tcf-0.2.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for iab-tcf-0.2.1.tar.gz
Algorithm Hash digest
SHA256 932aa5e9a7032f45c22a22b5d3f50d4a764ae20a68e8e825282fc144c4d23218
MD5 72a37b9924032b472cbbdfdfafa2946f
BLAKE2b-256 0f2ebe2085fe46195b1495a59bd383054b5fe51ce7d3642a9ecd0e7b8a09a3c1

See more details on using hashes here.

File details

Details for the file iab_tcf-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: iab_tcf-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for iab_tcf-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f7aef3dbcfdffbeab13015617a27f3b1cc5383cdc7289ba79787c846fb86b5b
MD5 46210a08f258d3396a4bca45587bb3e2
BLAKE2b-256 0fd96d862335a69fe346fc87ba1063d6ffe0504416ceaabe26db19ce62bf0ec9

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