improve parsing

This commit is contained in:
Tobias Brunner 2019-09-22 21:18:58 +02:00
parent 40947c59a6
commit 8c371e61d8
4 changed files with 9 additions and 4 deletions

View File

@ -71,11 +71,11 @@ class Lodur:
try: try:
zh_fw_ausg = datetime.strptime( zh_fw_ausg = datetime.strptime(
pdf_data['ausgerueckt'], pdf_data['ausgerueckt'],
'%H:%M', '%H:%M:%S',
) )
zh_am_schad = datetime.strptime( zh_am_schad = datetime.strptime(
pdf_data['vorort'], pdf_data['vorort'],
'%H:%M', '%H:%M:%S',
) )
except ValueError as err: except ValueError as err:
self.logger.error('[%s] Date parsing failed: %s', f_id, err) self.logger.error('[%s] Date parsing failed: %s', f_id, err)
@ -229,6 +229,7 @@ class Lodur:
# Encoding bk causes some troubles - therefore we skip that - but it # Encoding bk causes some troubles - therefore we skip that - but it
# would be good if it would be encoded as it can / will contain f.e.abs # would be good if it would be encoded as it can / will contain f.e.abs
# Umlauts # Umlauts
# AttributeError: 'bytes' object has no attribute 'parent'
self.logger.info('Form data: %s = %s', key, value) self.logger.info('Form data: %s = %s', key, value)
if key in ('eins_ereig', 'adr', 'wer_ala'): if key in ('eins_ereig', 'adr', 'wer_ala'):
self.browser[key] = value.encode('iso-8859-1') self.browser[key] = value.encode('iso-8859-1')

View File

@ -14,6 +14,8 @@ class PDFParsing:
def extract(self, f_id, file, datafields): def extract(self, f_id, file, datafields):
self.logger.info('[%s] parsing PDF file %s', f_id, file)
data = {} data = {}
for field, coordinate in datafields.items(): for field, coordinate in datafields.items():

View File

@ -39,7 +39,7 @@ LODUR_BASE_URL = os.getenv("LODUR_BASE_URL")
HEARTBEAT_URL = os.getenv("HEARTBEAT_URL") HEARTBEAT_URL = os.getenv("HEARTBEAT_URL")
GOTIFY_URL = os.getenv("GOTIFY_URL") GOTIFY_URL = os.getenv("GOTIFY_URL")
GOTIFY_TOKEN = os.getenv("GOTIFY_TOKEN") GOTIFY_TOKEN = os.getenv("GOTIFY_TOKEN")
PYLOKID_VERSION = "1.2.0" PYLOKID_VERSION = "2.0.0"
def main(): def main():
""" main """ """ main """

View File

@ -1,5 +1,7 @@
aioeasywebdav==2.4.0 aioeasywebdav==2.4.0
MechanicalSoup==0.12.0 # MechanicalSoup > 0.11.0 produces "TypeError: expected string or bytes-like
# object" on file upload
MechanicalSoup==0.11.0
paho-mqtt==1.3.1 paho-mqtt==1.3.1
python-dotenv==0.10.3 python-dotenv==0.10.3
requests>=2.20.0 requests>=2.20.0