article_dev.py 604 B

123456789101112131415161718192021222324252627282930
  1. """
  2. @author: luojunhui
  3. """
  4. import json
  5. import time
  6. import requests
  7. """
  8. aic: tencent, meta, kimi
  9. """
  10. url = "http://47.99.132.47:8888/article"
  11. body = {
  12. "aic": "tencent",
  13. "text": "",
  14. "title": "高血压可以这样饮食"
  15. }
  16. a = time.time()
  17. header = {
  18. "Content-Type": "application/json",
  19. }
  20. response = requests.post(url, json=body, headers=header, timeout=600)
  21. b = time.time()
  22. print(b - a)
  23. print(json.dumps(response.json(), ensure_ascii=False, indent=4))
  24. # with open("test_return.json", "w", encoding="utf-8") as f:
  25. # f.write(json.dumps(response.json(), ensure_ascii=False, indent=4))