task4.py 772 B

12345678910111213141516171819202122232425262728293031
  1. """
  2. @author: luojunhui
  3. """
  4. import time
  5. import requests
  6. def update_articles(gh_id):
  7. """
  8. :param gh_id:
  9. :return:
  10. """
  11. # url = "http://47.98.136.48:6060/article_crawler"
  12. url = "http://localhost:6060/article_crawler"
  13. headers = {"Content-Type": "application/json"}
  14. body = {"ghId": gh_id}
  15. response = requests.request("POST", url=url, headers=headers, json=body, timeout=120)
  16. print(response.status_code)
  17. print("info", response.text)
  18. print(response.json())
  19. # gh_id_list = ["gh_ac43e43b253b", "gh_93e00e187787", 'gh_68e7fdc09fe4', 'gh_77f36c109fb1', 'gh_7c66e0dbd2cf', 'gh_b181786a6c8c']
  20. #
  21. # for item in gh_id_list:
  22. # try:
  23. # update_articles(item)
  24. # time.sleep(5)
  25. # except Exception as e:
  26. # print(e)