[2ff88f42] refactor(connector-superoffice): finalize production readiness cleanup
- Integrated centralized logging system in all modules. - Extracted all IDs and ProgIds into a separate . - Refactored and for cleaner dependency management. - Included updated discovery and inspection utilities. - Verified end-to-end workflow stability.
This commit is contained in:
@@ -1,40 +1,25 @@
|
||||
import os
|
||||
import logging
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
from config import Config
|
||||
from logging_config import setup_logging
|
||||
from auth_handler import AuthHandler
|
||||
from superoffice_client import SuperOfficeClient
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = setup_logging("inspector")
|
||||
|
||||
def inspect_person(person_id):
|
||||
load_dotenv(dotenv_path="../.env")
|
||||
auth = AuthHandler()
|
||||
client = SuperOfficeClient(auth)
|
||||
|
||||
logger.info(f"Fetching Person with ID {person_id} to inspect structure...")
|
||||
|
||||
url = client._get_url(f"v1/Person/{person_id}")
|
||||
try:
|
||||
resp = client.session.get(url, headers=client._get_headers())
|
||||
resp.raise_for_status()
|
||||
person_data = resp.json()
|
||||
|
||||
print(f"\n--- PERSON STRUCTURE (ID: {person_id}) ---")
|
||||
print(json.dumps(person_data, indent=2))
|
||||
print("\n--- USER DEFINED FIELDS FOR THIS PERSON ---")
|
||||
if person_data.get("UserDefinedFields"):
|
||||
print(json.dumps(person_data["UserDefinedFields"], indent=2))
|
||||
else:
|
||||
print("(No UserDefinedFields found)")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to fetch person data: {e}")
|
||||
if hasattr(e, 'response') and e.response is not None:
|
||||
print(f"Details: {e.response.text}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Use the specific person ID provided by the user
|
||||
target_person_id = 9
|
||||
inspect_person(target_person_id)
|
||||
inspect_person(target_person_id)
|
||||
Reference in New Issue
Block a user