From 161e0c5387ec55d3884c8d04e49bdda709468c8c Mon Sep 17 00:00:00 2001
From: Maximilian Loch <Maximilian.Loch@LVermGeo.landsh.de>
Date: Tue, 9 May 2023 16:56:06 +0200
Subject: [PATCH] fixed print messages

---
 example_conn.cfg   |  3 ++-
 geocoder_script.py | 22 ++++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/example_conn.cfg b/example_conn.cfg
index 87ab86f..6eed2b7 100644
--- a/example_conn.cfg
+++ b/example_conn.cfg
@@ -3,4 +3,5 @@ host=host-ip
 port=port
 dbname=database name
 user=username
-pwd=password
\ No newline at end of file
+pwd=password
+url=API url
\ No newline at end of file
diff --git a/geocoder_script.py b/geocoder_script.py
index 4017447..ebb2a1d 100644
--- a/geocoder_script.py
+++ b/geocoder_script.py
@@ -16,7 +16,7 @@ if __name__ == '__main__':
     user={conn_config['connection']['user']}
     password={conn_config['connection']['pwd']}"""
 
-    url = r"https://chat.gdi-sh.de/aregapi/"
+    url = conn_config['connection']['url']
     # logfile = r"geocoder.log"
 
     my_db = DBTools(conn_str)
@@ -50,12 +50,12 @@ if __name__ == '__main__':
             if areg_response_key[0] == "ERROR":
                 errorfeatures += 1
 
-            print(
-                areg_response_key[0] + ": " +
-                areg_response[areg_response_key[0]] +
-                f""" | betroffene schule: [{item[0]}]\t{adresse['hnr']};
-                {adresse['stn']}; {adresse['plz']}; {adresse['ort']}"""
-            )
+            progress_msg = f"""\
+{areg_response_key[0]} : {areg_response[areg_response_key[0]]} | betroffene \
+schule: [{item[0]}]\t{adresse['hnr']}; {adresse['stn']};{adresse['plz']}; \
+{adresse['ort']}"""
+
+            print(progress_msg)
 
     my_db.closecursor()
 
@@ -65,7 +65,9 @@ if __name__ == '__main__':
     #         out.write(item)
 
     percentage = round((numfeatures * 100) / maxfeatures, 2)
-    print(f"""\nstatistics:\n {numfeatures} from {maxfeatures} geocoded >>
-    {percentage}%\n {missinfeatures} features with missing attributes\n
-    {errorfeatures} features with errors\n""")
+    statistics = f"""
+statistics:\n {numfeatures} from {maxfeatures} geocoded >> \
+{percentage}%\n {missinfeatures} features with missing attributes\n \
+{errorfeatures} features with errors\n"""
+    print(statistics)
     print("geocoding dataset finished, closing programm")
-- 
GitLab