[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:
45
connector-superoffice/tools/debug_raw_response.py
Normal file
45
connector-superoffice/tools/debug_raw_response.py
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Explicitly load .env from the project root
|
||||
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 get_raw_data(contact_id: int):
|
||||
print(f"🚀 Fetching RAW response for ContactId: {contact_id}")
|
||||
try:
|
||||
client = SuperOfficeClient()
|
||||
if not client.access_token:
|
||||
print("❌ Authentication failed.")
|
||||
return
|
||||
|
||||
# Build URL manually to avoid any JSON parsing in the client
|
||||
url = f"{client.base_url}/Contact/{contact_id}?$select=Name,UserDefinedFields"
|
||||
headers = client.headers
|
||||
|
||||
print(f"URL: {url}")
|
||||
resp = requests.get(url, headers=headers)
|
||||
|
||||
print(f"Status Code: {resp.status_code}")
|
||||
|
||||
# Save raw content to a file
|
||||
output_file = "raw_api_response.json"
|
||||
with open(output_file, "w") as f:
|
||||
f.write(resp.text)
|
||||
|
||||
print(f"✅ Raw response saved to {output_file}")
|
||||
print("\nFirst 500 characters of response:")
|
||||
print(resp.text[:500])
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_raw_data(171185)
|
||||
|
||||
Reference in New Issue
Block a user