[31188f42] Keine neuen Commits in dieser Session.
Keine neuen Commits in dieser Session.
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()
|
||||
54
connector-superoffice/tools/full_discovery.py
Normal file
54
connector-superoffice/tools/full_discovery.py
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Explicitly load .env
|
||||
dotenv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '.env'))
|
||||
load_dotenv(dotenv_path=dotenv_path, override=True)
|
||||
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
from superoffice_client import SuperOfficeClient
|
||||
|
||||
def run_discovery():
|
||||
print(f"🚀 Running Full Discovery on PRODUCTION...")
|
||||
try:
|
||||
client = SuperOfficeClient()
|
||||
if not client.access_token: return
|
||||
|
||||
# 1. Check Contact UDFs
|
||||
print("\n--- 🏢 CONTACT UDFs (ProgIDs) ---")
|
||||
contact_meta = client._get("Contact/default")
|
||||
if contact_meta and 'UserDefinedFields' in contact_meta:
|
||||
udfs = contact_meta['UserDefinedFields']
|
||||
for key in sorted(udfs.keys()):
|
||||
print(f" - {key}")
|
||||
|
||||
# 2. Check Person UDFs
|
||||
print("\n--- 👤 PERSON UDFs (ProgIDs) ---")
|
||||
person_meta = client._get("Person/default")
|
||||
if person_meta and 'UserDefinedFields' in person_meta:
|
||||
udfs = person_meta['UserDefinedFields']
|
||||
for key in sorted(udfs.keys()):
|
||||
print(f" - {key}")
|
||||
|
||||
# 3. Check specific List IDs (e.g. Verticals)
|
||||
# This often requires admin rights to see all list definitions
|
||||
print("\n--- 📋 LIST CHECK (Verticals) ---")
|
||||
# Assuming udlist331 is the list for Verticals (based on previous logs)
|
||||
list_data = client._get("List/udlist331/Items")
|
||||
if list_data and 'value' in list_data:
|
||||
print(f"Found {len(list_data['value'])} items in Vertical list.")
|
||||
for item in list_data['value'][:5]:
|
||||
print(f" - ID {item['Id']}: {item['Name']}")
|
||||
else:
|
||||
print(" ⚠️ Could not access Vertical list items.")
|
||||
|
||||
print("\n✅ Discovery Complete.")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_discovery()
|
||||
Reference in New Issue
Block a user