test_get_document.py 752 B

1234567891011121314151617181920212223242526
  1. import httpx
  2. import requests
  3. import json
  4. TEST_URL = "http://localhost:8501/api/get_document"
  5. TEST_URL = "http://localhost:8501/api/get_mdocument"
  6. TEST_HEADERS = {
  7. "Content-Type": "application/json; charset=utf-8"
  8. }
  9. def test():
  10. TEST_DATA={"action":"get", "title": "万能险"}
  11. try:
  12. response = requests.post(TEST_URL, headers=TEST_HEADERS, json=TEST_DATA)
  13. print(response.status_code)
  14. print(response.text)
  15. TEST_DATA={"action":"get", "title": "万能险\n地震"}
  16. response = requests.post(TEST_URL, headers=TEST_HEADERS, json=TEST_DATA)
  17. print(response.status_code)
  18. print(response.text)
  19. except Exception as e:
  20. print(f"Error: ",e)
  21. test()