[30388f42] Infrastructure Hardening: Repaired CE/Connector DB schema, fixed frontend styling build, implemented robust echo shield in worker v2.1.1, and integrated Lead Engine into gateway.
This commit is contained in:
65
connector-superoffice/tools/final_truth_check.py
Normal file
65
connector-superoffice/tools/final_truth_check.py
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
def check_truth():
|
||||
file_path = "raw_api_response.json"
|
||||
if not os.path.exists(file_path):
|
||||
print(f"❌ Datei {file_path} nicht gefunden.")
|
||||
return
|
||||
|
||||
print(f"🧐 Analysiere {file_path}...")
|
||||
try:
|
||||
with open(file_path, "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
udfs = data.get("UserDefinedFields", {})
|
||||
print(f"✅ JSON erfolgreich geladen. UDFs gefunden: {len(udfs)}")
|
||||
|
||||
invalid_keys = []
|
||||
for key in udfs.keys():
|
||||
if not isinstance(key, str):
|
||||
invalid_keys.append((key, type(key)))
|
||||
|
||||
if invalid_keys:
|
||||
print(f"❌ FEHLER GEFUNDEN! Folgende Keys sind KEINE Strings:")
|
||||
for k, t in invalid_keys:
|
||||
print(f" - Key: {k}, Typ: {t}")
|
||||
else:
|
||||
print("✅ Alle Keys in UserDefinedFields sind valide Strings.")
|
||||
|
||||
# Jetzt prüfen wir unsere eigenen Settings gegen dieses Dict
|
||||
print("\n--- Teste Zugriff mit unseren Settings ---")
|
||||
from dotenv import load_dotenv
|
||||
import sys
|
||||
|
||||
# Pfad zum Hauptverzeichnis für .env
|
||||
dotenv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '.env'))
|
||||
load_dotenv(dotenv_path=dotenv_path, override=True)
|
||||
|
||||
# Pfad für config import
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from config import settings
|
||||
|
||||
test_keys = {
|
||||
"Vertical": settings.UDF_VERTICAL,
|
||||
"Summary": settings.UDF_SUMMARY,
|
||||
"Opener": settings.UDF_OPENER
|
||||
}
|
||||
|
||||
for name, key in test_keys.items():
|
||||
print(f"Prüfe {name} (Key: '{key}', Typ: {type(key)})...")
|
||||
try:
|
||||
# Das ist die Stelle, die vorhin zum Absturz führte
|
||||
val = udfs.get(key)
|
||||
print(f" -> Zugriff erfolgreich! Wert: {val}")
|
||||
except TypeError as e:
|
||||
print(f" -> ❌ ABSTURZ: {e}")
|
||||
if isinstance(key, dict):
|
||||
print(f" Grund: settings.UDF_{name.upper()} ist ein DICTIONARY!")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Allgemeiner Fehler bei der Analyse: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_truth()
|
||||
Reference in New Issue
Block a user