Files
hv-cron/monatliche-forderung-eintragen.py
2021-02-22 19:10:40 +01:00

28 lines
622 B
Python

#!/usr/bin/python3
import requests
import datetime
class ServerException(Exception): pass
def postJson(url):
resp = requests.post(url)
if resp.status_code != 202:
raise ServerException("URL: {}, Code: {}, Msg: {}".format(url, resp.status_code, resp.text))
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))