test_req.py 455 B

123456789101112131415161718192021222324
  1. """
  2. @author: luojunhui
  3. """
  4. import json
  5. import time
  6. import requests
  7. url = "http://localhost:8888/videos"
  8. body = {
  9. "cate": "video_return",
  10. "start_date": "2024-04-02",
  11. "end_date": "2024-04-03",
  12. "topN": 10
  13. }
  14. a = time.time()
  15. header = {
  16. "Content-Type": "application/json",
  17. }
  18. response = requests.post(url, json=body, headers=header, timeout=600)
  19. b = time.time()
  20. print(b - a)
  21. print(json.dumps(response.json(), ensure_ascii=False, indent=4))