> ## 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.

# Articles

> Fetch and iterate framework articles with the Law4Devs Python SDK.

## Overview

Articles are the primary legal content of each framework. Every article belongs to exactly one framework, identified by its `framework_slug`. Use `client.articles` to list, fetch, and navigate them.

***

## Methods

### `list()`

Returns a page of article summaries for the given framework.

```python theme={null}
page = client.articles.list("gdpr", page=1, per_page=20)

print(f"GDPR has {page.meta.total} articles")
for article in page.data:
    print(f"  Art. {article.article_number}: {article.title}")
```

**Parameters**

| Parameter        | Type  | Default  | Description                   |
| ---------------- | ----- | -------- | ----------------------------- |
| `framework_slug` | `str` | required | Framework slug, e.g. `"gdpr"` |
| `page`           | `int` | `1`      | Page number                   |
| `per_page`       | `int` | `20`     | Items per page (1–100)        |

**Returns** `Page[ArticleSummary]`

***

### `get()`

Fetch the full content of a single article, including all paragraphs.

```python theme={null}
article = client.articles.get("gdpr", 17)

print(article.title)
print(article.content)

for para in article.paragraphs:
    print(f"  §{para.paragraph_number}: {para.content}")
```

**Parameters**

| Parameter        | Type  | Description                         |
| ---------------- | ----- | ----------------------------------- |
| `framework_slug` | `str` | Framework slug                      |
| `article_number` | `int` | Article number within the framework |

**Returns** `Article`

***

### `related()`

Fetch articles related to a given article (linked via shared requirements or tags).

```python theme={null}
page = client.articles.related("gdpr", 17)

for article in page.data:
    print(f"  Related: Art. {article.article_number} — {article.title}")
```

**Parameters**

| Parameter        | Type  | Default  | Description            |
| ---------------- | ----- | -------- | ---------------------- |
| `framework_slug` | `str` | required | Framework slug         |
| `article_number` | `int` | required | Article number         |
| `page`           | `int` | `1`      | Page number            |
| `per_page`       | `int` | `20`     | Items per page (1–100) |

**Returns** `Page[ArticleSummary]`

***

### `iter()`

Iterate over all articles in a framework across all pages.

```python theme={null}
for article in client.articles.iter("gdpr"):
    print(f"Art. {article.article_number}: {article.title}")
```

**Parameters** — same kwargs as `list()` (except `page`).

**Returns** `Iterator[ArticleSummary]`

***

## Models

### `ArticleSummary`

Returned by `list()`, `related()`, and `iter()`.

| Field             | Type          | Description                         |
| ----------------- | ------------- | ----------------------------------- |
| `id`              | `int`         | Internal numeric ID                 |
| `framework_slug`  | `str`         | Parent framework slug               |
| `article_number`  | `int`         | Article number within the framework |
| `title`           | `str \| None` | Article heading                     |
| `position`        | `int`         | Ordering position in the framework  |
| `paragraph_count` | `int`         | Number of paragraphs                |
| `tags`            | `list[str]`   | Tag slugs applied to this article   |

### `Article`

Returned by `get()`. Extends `ArticleSummary` with:

| Field        | Type              | Description                            |
| ------------ | ----------------- | -------------------------------------- |
| `content`    | `str \| None`     | Full plain-text content of the article |
| `paragraphs` | `list[Paragraph]` | Ordered list of paragraph objects      |

### `Paragraph`

| Field              | Type  | Description                          |
| ------------------ | ----- | ------------------------------------ |
| `id`               | `int` | Internal numeric ID                  |
| `paragraph_number` | `str` | Label, e.g. `"1"`, `"2a"`, `"intro"` |
| `content`          | `str` | Paragraph text                       |
| `position`         | `int` | Ordering position within the article |

***

## Examples

### Print every GDPR chapter with article titles

```python theme={null}
from law4devs import Law4DevsClient

client = Law4DevsClient()

for article in client.articles.iter("gdpr"):
    print(f"Art. {article.article_number:>3}  {article.title or '(untitled)'}")
```

### Fetch a specific article and display it

```python theme={null}
article = client.articles.get("gdpr", 17)

print(f"Article {article.article_number}: {article.title}")
print("=" * 60)
for para in article.paragraphs:
    print(f"\n({para.paragraph_number}) {para.content}")
```

### Find all articles tagged with a specific tag

```python theme={null}
tagged = [
    a for a in client.articles.iter("gdpr")
    if "data-breach" in a.tags
]
print(f"{len(tagged)} articles tagged 'data-breach'")
```

### Cross-reference related articles

```python theme={null}
article = client.articles.get("gdpr", 33)  # Personal data breach notification

related = client.articles.related("gdpr", 33)
print(f"Art. 33 is related to {related.meta.total} other articles:")
for r in related.data:
    print(f"  Art. {r.article_number}: {r.title}")
```

### Collect all articles into a dict for fast lookup

```python theme={null}
articles_by_number = {
    a.article_number: a
    for a in client.articles.iter("cra")
}

print(articles_by_number[10].title)
```

<Tip>
  Use `iter()` when you need every article. Use `list()` when you only need one page or want to control pagination yourself.
</Tip>
