score_list_dev.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """
  2. @author: luojunhui
  3. """
  4. import json
  5. import time
  6. import requests
  7. from concurrent.futures.thread import ThreadPoolExecutor
  8. def score_list(account):
  9. """
  10. url = "http://192.168.100.31:8179/score_list"
  11. url1 = "http://47.98.154.124:6060/score_list"
  12. # url1 = "http://localhost:6060/score_list"
  13. url2 = "http://192.168.100.31:6062/score_list"
  14. :param account:
  15. :return:
  16. """
  17. url2 = "http://47.98.136.48:6060/score_list"
  18. body = {
  19. "account_nickname_list": [account],
  20. "text_list": [
  21. "在俄罗斯买好地了,却发现没有公路、码头、仓储、燃气管道……”",
  22. "被霸占15年后成功收回,岛礁资源超100万吨,曾遭到美菲联手抢夺",
  23. "感人!河南姐弟被父母遗弃,7岁弟弟带着姐姐看病:别怕,以后我养",
  24. "山东26岁女子产下罕见“4胞胎”,丈夫却突然消失,婆婆:养不起"
  25. ],
  26. "max_time": None,
  27. "min_time": None,
  28. "interest_type": "avg",
  29. "sim_type": "mean",
  30. "rate": 0.1
  31. }
  32. response = requests.post(url=url2, headers={}, json=body).json()
  33. print(json.dumps(response, ensure_ascii=False, indent=4))
  34. return response
  35. if __name__ == '__main__':
  36. # a = time.time()
  37. # with ThreadPoolExecutor(max_workers=100) as pool:
  38. # pool.map(score_list, ["生活良读"] * 1)
  39. # b = time.time()
  40. # print(b - a)
  41. a = time.time()
  42. res = score_list("生活情感叁读")
  43. b = time.time()
  44. print(b - a)