#!/usr/bin/python3 import requests import datetime class ResourceNotFoundException(Exception): pass def postJson(url): resp = requests.post(url) if resp.status_code != 202: raise ResourceNotFoundException("URL: {}, Code: {}".format(url, resp.status_code)) return resp.json() BASE_URL = "http://172.16.10.29:5000/hv" URL_INSERT_FORDERUNGEN = "{base}/forderung/insertAllForMonth" TEMPLATE_FILE = "inserted.tmpl" try: postJson(URL_INSERT_FORDERUNGEN.format(base=BASE_URL)) print("Monatliche Mietforderungen erfolgreich eintragen") except Exception as e: print("ERROR: {}".format(e))