A Python implementation of the IAB consent strings (v1.1 and v2)
Project description
iab-tcf
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
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cf487331859ccdecec5bfab8434aa77677054092b95209e4c0d38e5c5c3f5ee |
|
MD5 | 7749b8b6974b5af3d4ee181b671e6692 |
|
BLAKE2b-256 | 56e24f55d67b5a42318f959ebacb629fb0701ab5aecb11d7510fd9b26e967a9d |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 978ad80f0ea827f30b16646a271bc0f4812ce083012241150988c0cb11ccb605 |
|
MD5 | e4ed7de55b4b3d197bd024ed70f46119 |
|
BLAKE2b-256 | cffca3f3701da727a0f1cfe16b4b3104da2cfcda8c095efd3f279588f7eac345 |