iab_tcf.v2 package

Submodules

iab_tcf.v2.non_core_segments module

class iab_tcf.v2.non_core_segments.NonCoreSegment(segment: bytes)[source]

Bases: object

Represents a non core segment that can contain information regarding disclosed vendors, allowed vendors or publiser tc.

Parameters:segment – The segment to process in bytes.
ALLOWED_VENDORS = 2
CORE = 0
DISCLOSED_VENDORS = 1
PUBLISHER_TC = 3
is_allowed_vendors()[source]

Checks if the non core segment contains information about Allowed Vendors.

is_disclosed_vendors()[source]

Checks if the non core segment contains information about Disclosed Vendors.

is_publisher_tc()[source]

Checks if the non core segment contains information about Publisher TC.

read_publisher_tc() → iab_tcf.v2.publisher_tc.PubTCEntry[source]

If the non core segment is type Publisher TC, this method processes and extracts the information inside an entry object for easy access.

read_vendors() → Dict[int, bool][source]

If the non core segment is type Disclosed Vendors or Allowed Vendors, this method processes its information extracting a map bitfield with the vendors enabled.

iab_tcf.v2.publisher_restriction module

class iab_tcf.v2.publisher_restriction.PubRestrictionEntry(purpose_id: int, restriction_type: str, restrictions_range: List[Tuple[int, int]])[source]

Bases: object

Represents a publisher restriction entry that can be used to perform several operation on that information.

Parameters:
  • purpose_id – The purpose this publisher restriction applies to.
  • restriction_type – The type this restriction applies to.
  • restrictions_range – The range of publishers this restriction applies to.
PURPOSE_FLATLY_NOT_ALLOWED = 0
REQUIRE_LEGITIMATE_INTEREST = 2
UNDEFINED = 3

Checks if the restriction type is REQUIRE_CONSENT

is_in_range(publisher: int) → bool[source]

Checks if the publisher received is affected by this restriction or not

is_legitimate_interest_required()[source]

Checks if the restriction type is REQUIRE_LEGITIMATE_INTEREST

is_not_allowed()[source]

Checks if the restriction type is PURPOSE_FLATLY_NOT_ALLOWED

is_publisher_restricted(publisher: int) → bool[source]

If the publisher is in the range specified for this restriction and the restriction type is PURPOSE_FLATLY_NOT_ALLOWED then the publisher is restricted.

iab_tcf.v2.publisher_tc module

class iab_tcf.v2.publisher_tc.PubTCEntry(purposes_consent: Dict[int, bool], purposes_lit_transparency: Dict[int, bool], custom_purposes_consent: Dict[int, bool], custom_purposes_lit_transparency: Dict[int, bool])[source]

Bases: object

Represents a Publisher TC entry that can be used to retrieve further information.

Parameters:
  • purposes_consent – The publisher’s purposes consent.
  • purposes_lit_transparency – The publisher’s purposes legitimate interest consents.
  • custom_purposes_consent – The publisher’s custom purposes consent.
  • custom_purposes_lit_transparency – The publisher’s custom purposes legitimate interest consents.

Module contents