handle Einsatzrapport WebDav Inbox
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f9b86f3c8f
commit
18bbcadb2c
|
@ -4,6 +4,7 @@
|
|||
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
from datetime import datetime
|
||||
import logging
|
||||
import asyncio
|
||||
|
@ -75,6 +76,19 @@ class WebDav:
|
|||
else:
|
||||
return False
|
||||
|
||||
def einsatzrapport_with_f_id_exists(self):
|
||||
"""check if an einsatzrapport with an f_id exists in the WebDav Inbox"""
|
||||
|
||||
filelist = self.loop.run_until_complete(
|
||||
self.webdav.ls(f"{self.webdav_basedir}/Inbox")
|
||||
)
|
||||
for file in filelist:
|
||||
full_path = file[0]
|
||||
parsed = re.search(".*Einsatzrapport_(F[0-9].*)\.pdf", full_path)
|
||||
if parsed:
|
||||
f_id = parsed.group(1)
|
||||
self.logger.info("[%s] Found %s", f_id, full_path)
|
||||
|
||||
def store_data(self, f_id, file_name, data):
|
||||
"""stores data on webdav"""
|
||||
|
||||
|
|
|
@ -261,6 +261,8 @@ def main():
|
|||
logger.error("[%s] Unknown type: %s", f_id, f_type)
|
||||
|
||||
# TODO check webdav for Einsatzrapport PDF with f_id in filename and then process it
|
||||
logger.info("Checking WebDav Inbox folder for Einsatzrapporte to process")
|
||||
webdav_client.einsatzrapport_with_f_id_exists()
|
||||
|
||||
# send heartbeat
|
||||
requests.get(HEARTBEAT_URL)
|
||||
|
|
Loading…
Reference in a new issue