gogo2/debug_callback_simple.py
Dobromir Popov 378e88be06 wip
2025-05-26 22:46:55 +03:00

53 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""
Simple callback debug script to see exact error
"""
import requests
import json
def test_simple_callback():
"""Test a simple callback to see the exact error"""
try:
# Test the simplest possible callback
callback_data = {
"output": "current-balance.children",
"inputs": [
{
"id": "ultra-fast-interval",
"property": "n_intervals",
"value": 1
}
]
}
print("Sending callback request...")
response = requests.post(
'http://127.0.0.1:8051/_dash-update-component',
json=callback_data,
timeout=15,
headers={'Content-Type': 'application/json'}
)
print(f"Status Code: {response.status_code}")
print(f"Response Headers: {dict(response.headers)}")
print(f"Response Text (first 1000 chars):")
print(response.text[:1000])
print("=" * 50)
if response.status_code == 500:
# Try to extract error from HTML
if "Traceback" in response.text:
lines = response.text.split('\n')
for i, line in enumerate(lines):
if "Traceback" in line:
# Print next 20 lines for error details
for j in range(i, min(i+20, len(lines))):
print(lines[j])
break
except Exception as e:
print(f"Request failed: {e}")
if __name__ == "__main__":
test_simple_callback()