fs-lawrisk/tests/test_v2_api.py

18 lines
566 B
Python

import requests
import json
url = "http://localhost:8000/fs-ai-asistant/api/workflow/lawrisk/v2"
payload = {"query": "公众聚集场所投入使用、营业前消防安全检查"}
headers = {'Content-Type': 'application/json'}
try:
response = requests.post(url, json=payload, headers=headers)
print(f"Status Code: {response.status_code}")
if response.status_code == 200:
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
else:
print(response.text)
except Exception as e:
print(f"Error: {e}")