A Python implementation of the IAB Transparency and Consent Framework (TCF) consent strings, supporting both v1.1 and v2. Current version: 0.2.2, with Python 3.6+ support. Low release cadence.
pip install iab-tcfVerified import paths — ran on the pinned version, not inferred.
Decode a v2 string and encode a v1 string.
Check version: v2 strings use properties like .vendor_consents and .purpose_consents; v1 uses methods like .get_vendors_allowed().
Always set version, created, last_updated, cmp_id, cmp_version, consent_screen, consent_language, vendor_list_version, tcf_policy_version, purpose_allowed, and vendors_allowed.
Ensure bitarray-hardbyte is installed, not bitarray. pip install iab-tcf handles this automatically.
Use TCString for v2 strings instead of ConsentString when possible.