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.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: iab-tcf-0.2.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for iab-tcf-0.2.2.tar.gz
Algorithm Hash digest
SHA256 7cf487331859ccdecec5bfab8434aa77677054092b95209e4c0d38e5c5c3f5ee
MD5 7749b8b6974b5af3d4ee181b671e6692
BLAKE2b-256 56e24f55d67b5a42318f959ebacb629fb0701ab5aecb11d7510fd9b26e967a9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iab_tcf-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for iab_tcf-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 978ad80f0ea827f30b16646a271bc0f4812ce083012241150988c0cb11ccb605
MD5 e4ed7de55b4b3d197bd024ed70f46119
BLAKE2b-256 cffca3f3701da727a0f1cfe16b4b3104da2cfcda8c095efd3f279588f7eac345

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page