1234567891011121314151617181920 |
- import httpx
- import requests
- import json
- TEST_URL = "http://localhost:8501/api/search"
- TEST_HEADERS = {
- "Content-Type": "application/json; charset=utf-8"
- }
- TEST_DATA={"action":"search", "query": "万能险", "top_k": 10}
- print(json.dumps(TEST_DATA))
- def test():
-
- try:
- 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()
|