rank_dev.py 537 B

12345678910111213141516171819
  1. import json
  2. import requests
  3. import time
  4. url = "http://47.98.154.124:6060/articleRank"
  5. with open("body.json") as f:
  6. data = json.loads(f.read())
  7. body = json.loads(data['data'])
  8. headers = {"Content-Type": "application/json"}
  9. a = time.time()
  10. response = requests.post(url=url, headers=headers, json=body)
  11. b = time.time()
  12. print(json.dumps(response.json(), ensure_ascii=False, indent=4))
  13. print(b - a)
  14. for res in response.json()['data']['rank_list']:
  15. print(res['title'], res['producePlanName'], res['score'], res['crawlerViewCount'])