pressure_test.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """
  2. @author: luojunhui
  3. """
  4. import time
  5. import requests
  6. from concurrent.futures import ThreadPoolExecutor
  7. body = {
  8. "version":"v2",
  9. "features": {
  10. "channel": "小年糕",
  11. "out_user_id": "66506470",
  12. "mode": "author",
  13. "out_play_cnt": 698,
  14. "out_like_cnt": 1,
  15. "out_share_cnt": 41,
  16. "title": "收藏好这九种中成药,让你少往医院跑。?",
  17. "lop": 701 / 24698, # like_cnt + 700 / play_cnt + 24000
  18. "duration": 180
  19. }
  20. }
  21. features = {
  22. "channel": "小年糕",
  23. "out_user_id": "66506470",
  24. "mode": "author",
  25. "out_play_cnt": 698,
  26. "out_like_cnt": 1,
  27. "out_share_cnt": 41,
  28. "title": "收藏好这九种中成药,让你少往医院跑。?",
  29. "lop": 701 / 24698,
  30. "duration": 180
  31. }
  32. url = "http://127.0.0.1:5000/lightgbm_score"
  33. while True:
  34. t = time.time()
  35. res = requests.post(url, json=body)
  36. e = time.time()
  37. print(res.json())
  38. print("cost time:", e - t, "s")
  39. time.sleep(0.5)