score_list_dev.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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://61.48.133.26:6061/score_list"
  18. body = {
  19. "gh_id_list": [
  20. "gh_02f5bca5b5d9"
  21. ],
  22. "text_list": [
  23. "在俄罗斯买好地了,却发现没有公路、码头、仓储、燃气管道……”",
  24. "被霸占15年后成功收回,岛礁资源超100万吨,曾遭到美菲联手抢夺",
  25. "感人!河南姐弟被父母遗弃,7岁弟弟带着姐姐看病:别怕,以后我养",
  26. "山东26岁女子产下罕见“4胞胎”,丈夫却突然消失,婆婆:养不起"
  27. ],
  28. "interest_type": "account_avg",
  29. "sim_type": "avg",
  30. "rate": 0.1,
  31. "view_count_filter": 1000
  32. }
  33. response = requests.post(url=url2, headers={}, json=body).json()
  34. print(json.dumps(response, ensure_ascii=False, indent=4))
  35. return response
  36. if __name__ == '__main__':
  37. # a = time.time()
  38. # with ThreadPoolExecutor(max_workers=100) as pool:
  39. # pool.map(score_list, ["生活良读"] * 1)
  40. # b = time.time()
  41. # print(b - a)
  42. a = time.time()
  43. res = score_list("生活情感叁读")
  44. b = time.time()
  45. print(b - a)