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.
Metadata
Release files for iab-tcf-bitarray 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iab_tcf_bitarray-0.2.3.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iab_tcf_bitarray-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.9 kB
Release files / iab_tcf_bitarray-0.2.3.tar.gz
| Download URL | iab_tcf_bitarray-0.2.3.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07d1a0cdb325a851ac2379f71747600518ebab07bce795e8ccd723a682cd52d7
|
|
BLAKE2b-256 checksum How to use checksums |
892aa04efed9ebe944ee116064307db50cd9e1e7993d9c7902d15bd73597af5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / iab_tcf_bitarray-0.2.3-py3-none-any.whl
| Download URL | iab_tcf_bitarray-0.2.3-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e3def7bcda89ff6e8fe1cee06e2f5af2615c8a1b15fafbc6f37778016f374a5
|
|
BLAKE2b-256 checksum How to use checksums |
5bb0ca4f13e39c035aeb10e4044bc83b39ae764b25ec8c4e5d40df2c82d709a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|