You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
import os |
|
import json |
|
from pprint import pprint |
|
|
|
files = os.listdir('documents') |
|
|
|
with open(f'documents/{files[0]}', encoding='utf-8-sig') as f: |
|
print(files[0]) |
|
data = json.loads(f.read())['dokumentstatus'] |
|
|
|
for k, v in data.items(): |
|
print(k.upper()) |
|
pprint(v) |
|
print() |
|
print() |
|
|
|
document = data['dokument'] |
|
d = { |
|
'file_url': document['filbilaga']['fil'][0]['url'], |
|
'dokument_url_text': document['dokument_url_text'], |
|
'dokument_url_text_markdown': f"[Ladda ner]({document['dokument_url_text']})", |
|
'debattnamn': document['debattnamn'], |
|
'datum': document['datum'], |
|
'dok_id': document['dok_id'], |
|
'dokintressent': document['dokintressent'], |
|
'notis': document['notis'], |
|
'summary': document['summary'], |
|
'files': len(document['filbilaga']['fil']), |
|
'subtyp': document['subtyp'], |
|
"titel": document["titel"], |
|
"undertitel": document["undertitel"], |
|
"dokumentnamn": document["dokumentnamn"], |
|
'partibet': intressent['partibet'], |
|
'person': intressent['namn'] |
|
|
|
} |
|
|
|
for k, v in d.items(): |
|
print(k, v) |