change formatting for individual output
This commit is contained in:
parent
7358b47384
commit
1abf37d175
1 changed files with 11 additions and 4 deletions
15
crawler.py
15
crawler.py
|
|
@ -4,6 +4,7 @@ import json
|
|||
from bs4 import BeautifulSoup
|
||||
from time import sleep
|
||||
from os.path import commonprefix
|
||||
from os import makedirs
|
||||
from git import Repo
|
||||
import argparse
|
||||
from datetime import datetime
|
||||
|
|
@ -84,7 +85,8 @@ Biographie: {self.cv}
|
|||
|
||||
## Sonstige Gremien: {funcs_to_str(self.additional_functions)}
|
||||
|
||||
# Mandat {self.mandate[0], self.mandate[1]}
|
||||
# Mandat
|
||||
{self.mandate[0], self.mandate[1]}
|
||||
|
||||
# Veröffentlichungspflichtige Angaben
|
||||
{self.disclosures.replace(DISCLOSURE_DISLAIMER, "")}
|
||||
|
|
@ -145,9 +147,14 @@ def main():
|
|||
def save_individuals(bios, out):
|
||||
for rep in bios:
|
||||
first_letter = rep.name[0][0].upper()
|
||||
name_str = f"{rep.name[1]} {rep.name[0]}".replace(" ", "_")
|
||||
with open(f"{out}/Abgeordnete/{first_letter}/{name_str}.md") as rep_file:
|
||||
json.dump(str(rep), rep_file, indent=2, ensure_ascii=False)
|
||||
name_str = f"{rep.name[0]} {rep.name[1]}".replace(" ", "_")
|
||||
dir = f"{out}/Abgeordnete/{first_letter}"
|
||||
try:
|
||||
makedirs(dir)
|
||||
except FileExistsError:
|
||||
pass
|
||||
with open(f"{dir}/{name_str}.md", "w") as rep_file:
|
||||
rep_file.write(str(rep))
|
||||
|
||||
|
||||
def save_raw(bios, out):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue