Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Tags are predefined classification labels applied to articles and requirements. They enable cross-framework filtering by topic — for example, finding all content related to "data-breach" across GDPR, NIS2, and the CRA.

Methods

list()

Returns a page of all tags.
page = client.tags.list()

print(f"Total tags: {page.meta.total}")
for tag in page.data:
    print(f"  {tag.slug}: {tag.name}")
Parameters
ParameterTypeDefaultDescription
pageint1Page number
per_pageint20Items per page (1–100)
Returns Page[Tag]

get()

Fetch a single tag by its slug.
tag = client.tags.get("data-breach")

print(tag.name)         # "Data Breach"
print(tag.description)  # "Articles relating to personal data breach..."
print(tag.keywords)     # ["breach", "notification", "incident", ...]
print(tag.color)        # "#e74c3c"
Parameters
ParameterTypeDescription
slugstrTag slug, e.g. "data-breach"
Returns Tag

iter()

Iterate over all tags.
for tag in client.tags.iter():
    print(f"{tag.slug}: {tag.name}")
Returns Iterator[Tag]

Model

Tag

FieldTypeDescription
idintInternal numeric ID
slugstrURL-safe identifier, e.g. "data-breach"
namestrHuman-readable label
descriptionstr | NoneWhat this tag covers
keywordslist[str]Keywords used to auto-tag content
colorstr | NoneHex color code for UI display
created_atstrISO 8601 creation timestamp

Examples

from law4devs import Law4DevsClient

client = Law4DevsClient()

for tag in client.tags.iter():
    desc = tag.description or "(no description)"
    print(f"{tag.name:25} {desc[:60]}")

Look up a tag’s keywords

tag = client.tags.get("consent")
print(f"Auto-tag keywords for '{tag.name}':")
for keyword in tag.keywords:
    print(f"  - {keyword}")

Find all articles tagged with a given label

target_tag = "security"

matches = [
    article
    for article in client.articles.iter("nis2")
    if target_tag in article.tags
]

print(f"{len(matches)} NIS2 articles tagged '{target_tag}':")
for a in matches:
    print(f"  Art. {a.article_number}: {a.title}")

Build a tag index across all frameworks

tag_index = {}  # tag_slug -> list of (framework, article_number)

for fw in client.frameworks.iter():
    for article in client.articles.iter(fw.slug):
        for tag_slug in article.tags:
            tag_index.setdefault(tag_slug, []).append(
                (fw.slug, article.article_number)
            )

# Print most used tags
for slug, refs in sorted(tag_index.items(), key=lambda x: -len(x[1])):
    print(f"{slug}: {len(refs)} articles")
Tag slugs are stable — safe to hardcode in application logic or store in databases as foreign keys.