summaryrefslogtreecommitdiff
path: root/http.py
blob: 946bd5f2a5aa410cd01bb289a264c1c502cebe09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3

import csv
from roff import (
    now,
    roff_table,
    section_heading,
    subsection_heading,
    title_heading,
)
title_heading('HTTP', 7,
              footer_middle=f"{now():%Y-%m-%d}")

section_heading("STATUS CODES")

with open('http-status-codes-1.csv') as f:
    entries = list(csv.DictReader(f))

roff_table([("Code", 'R'),
            ("Description", "L"),
            ("Reference", 'L')],
           ["Value", "Description", "Reference"],
           entries)

section_heading('HEADERS')

with open("field-names.csv") as f:
    entries = list(csv.DictReader(f))

for entry in entries:
    subsection_heading(entry["Field Name"])
    print(entry["Status"] + ", ")
    print(entry["Reference"])
    print()
    print(entry["Comments"])