iab_tcf package¶
Subpackages¶
Submodules¶
iab_tcf.bits module¶
-
class
iab_tcf.bits.Reader(consent: bytes)[source]¶ Bases:
objectRepresents a bit reader that can extract bits sequentially from a bytes consent and return a representation in different formats.
Parameters: consent – The consent to process in bytes. -
read_bitfield(n: int) → Dict[int, bool][source]¶ Reads certain number of bits from the pointer position and returns the value as a dictionary. The key is the bit position (starting by 1) and the value is True if the bit is 1 and False if the bit is 0.
Parameters: n – Number of bits to retrieve and transform into the dictionary. The dictionary will have as many keys as n.
-
read_bits(n: int) → bitarray.bitarray[source]¶ Reads the number of bits requested from the pointer position and automatically advances the pointer of the reader for the subsequent read_bits calls.
Parameters: n – Number of bits to retrieve.
-
read_int(n: int) → int[source]¶ Reads certain number of bits from the pointer position and returns the value as integer.
Parameters: n – Number of bits to retrieve and transform into int.
-
read_range(n: int) → List[Tuple[int, int]][source]¶ Reads a complex “ranged” type from the reader given the number of ranges we are expecting to find.
For each range: - The first bit indicates if it’s a range or just a value. - If it’s a range, the next 16 bits are the start int and the
next 16 bits are the end int.- If it’s not a range, the next 16 bits are the start and the
- end is the same as start.
Parameters: n – Number of ranges we are going to process.
-
iab_tcf.iab_tcf module¶
-
iab_tcf.iab_tcf.base64_decode(segment: str) → bytes[source]¶ Helper to decode the IAB TCF segments encoded.
iab_tcf.iab_tcf_v1 module¶
-
class
iab_tcf.iab_tcf_v1.ConsentV1(consent: bytes)[source]¶ Bases:
objectRepresents a v1.1 consent with all the information extracted.
Parameters: consent – The consent to process in bytes.
iab_tcf.iab_tcf_v2 module¶
-
class
iab_tcf.iab_tcf_v2.ConsentV2(consent: bytes)[source]¶ Bases:
objectRepresents a v2 consent with all the information extracted.
Parameters: consent – The consent to process in bytes. -
get_restriction(publisher: int, purpose: int) → iab_tcf.v2.publisher_restriction.PubRestrictionEntry[source]¶
-
is_purpose_allowed(id: int) → bool[source]¶ Checks if a purpose is allowed or not.
Parameters: id – Purpose id to check if it’s allowed or not.
-
is_vendor_allowed(id: int) → bool[source]¶ Checks if a vendor is allowed or not.
Parameters: id – Vendor id to check if it’s allowed or not.
-
read_consent_vendors()[source]¶ Reads the consent vendors. It must be called with the reader already in the position where the consent vendors start.
-
read_interest_vendors()[source]¶ Reads the interest vendors. It must be called with the reader already in the position where the interest vendors start.
-