from superoffice_client import SuperOfficeClient import json import logging # Setup minimal logging logging.basicConfig(level=logging.ERROR) def verify_contact(contact_id): print(f"🔍 Verifying REAL SuperOffice Data for Contact {contact_id}...") client = SuperOfficeClient() if not client.access_token: print("❌ Auth failed.") return contact = client.get_contact(contact_id) if not contact: print("❌ Contact not found.") return # 1. Standard Fields print("\n--- Standard Fields ---") print(f"Name: {contact.get('Name')}") print(f"OrgNr: {contact.get('OrgNr')}") # Changed from OrgNumber addr = contact.get("Address", {}) # Changed from PostalAddress print(f"Raw Address JSON: {json.dumps(addr, indent=2)}") if addr: postal = addr.get("Postal", {}) street = addr.get("Street", {}) print(f"Postal City: {postal.get('City')}") print(f"Street City: {street.get('City')}") else: print("Address: (Empty)") print("Address: (Empty)") # 2. UDFs print("\n--- User Defined Fields (UDFs) ---") udfs = contact.get("UserDefinedFields", {}) if not udfs: print("(No UDFs found)") else: for k, v in udfs.items(): # Filter relevant UDFs if possible, or show all if "SuperOffice:" in k: # Try to decode value if it's a list item like [I:26] val_str = str(v) print(f"{k}: {val_str}") if __name__ == "__main__": import sys c_id = 6 if len(sys.argv) > 1: c_id = int(sys.argv[1]) verify_contact(c_id)