import sys
import io
import json
import urllib.request
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')

data = json.dumps({"user_query": "d? di an cu?i", "user_insight": None, "chat_history_summary": ""}).encode('utf-8')
req = urllib.request.Request("http://localhost:5000/api/agent/lead-stage", data=data, headers={'Content-Type': 'application/json'})
try:
    with urllib.request.urlopen(req) as f:
        print(f.read().decode('utf-8'))
except Exception as e:
    print(e)
