import httpx import requests import json TEST_URL = "http://localhost:8501/api/get_document" TEST_URL = "http://localhost:8501/api/get_mdocument" TEST_HEADERS = { "Content-Type": "application/json; charset=utf-8" } def test(): TEST_DATA={"action":"get", "title": "万能险"} try: response = requests.post(TEST_URL, headers=TEST_HEADERS, json=TEST_DATA) print(response.status_code) print(response.text) TEST_DATA={"action":"get", "title": "万能险\n地震"} response = requests.post(TEST_URL, headers=TEST_HEADERS, json=TEST_DATA) print(response.status_code) print(response.text) except Exception as e: print(f"Error: ",e) test()