77b474f77b
All checks were successful
Build Kurzpraesentation_Plenum.tex / build_Kurzpraesentation_Plenum (push) Successful in 1m36s
68 lines
1.7 KiB
Python
68 lines
1.7 KiB
Python
from bs4 import BeautifulSoup
|
|
import requests
|
|
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
|
from datetime import date
|
|
import pandas as pd
|
|
import os
|
|
|
|
|
|
env = Environment(loader=FileSystemLoader("templates"), autoescape=select_autoescape())
|
|
|
|
|
|
def get_befragung():
|
|
r = requests.get("https://tvstud-stats.fblanke.de/")
|
|
soup = BeautifulSoup(r.text, "html.parser")
|
|
|
|
total = soup.find("table").find("tfoot").find_all("td")[1].text
|
|
return total
|
|
|
|
|
|
def generate_bundesweite_ziele_tex():
|
|
template = env.get_template("bundesweite_ziele.tex")
|
|
|
|
return template.render(
|
|
boegen="3078",
|
|
eintritte="\\textasciitilde{}~200",
|
|
botschafter="?",
|
|
befragung=get_befragung(),
|
|
datum=date.today().isoformat(),
|
|
)
|
|
|
|
|
|
def update_bundesweite_ziele_tex():
|
|
with open("../slides/bundesweite_ziele.tex", "w") as f:
|
|
f.write(generate_bundesweite_ziele_tex())
|
|
|
|
# Keep newline at the end of file, single newline will be stripped
|
|
f.write("\n")
|
|
f.write("\n")
|
|
|
|
|
|
def generate_aktueller_stand_strukturaufbau():
|
|
template = env.get_template("aktueller_stand_strukturaufbau.tex")
|
|
|
|
data_file = "data.csv"
|
|
data = pd.read_csv(data_file)
|
|
|
|
return template.render(
|
|
bonn=data["Bonn"],
|
|
bund=data["Bund"],
|
|
)
|
|
|
|
|
|
def update_aktueller_stand_strukturaufbau_tex():
|
|
with open("../slides/aktueller_stand_strukturaufbau.tex", "w") as f:
|
|
f.write(generate_aktueller_stand_strukturaufbau())
|
|
|
|
# Keep newline at the end of file, single newline will be stripped
|
|
f.write("\n")
|
|
f.write("\n")
|
|
|
|
|
|
def main():
|
|
update_bundesweite_ziele_tex()
|
|
update_aktueller_stand_strukturaufbau_tex()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|