forward_request.py 455 B

12345678910111213141516171819202122
  1. """
  2. @author: luojunhui
  3. """
  4. import requests
  5. from applications.const import server_const
  6. async def forward_requests(params, api):
  7. """
  8. 转发请求
  9. :return:
  10. """
  11. new_url = "http://{}:{}/{}".format(server_const.OLD_SERVER_INNER_IP, server_const.PORT, api)
  12. response = requests.post(
  13. url=new_url,
  14. headers={
  15. "Content-Type": "application/json",
  16. },
  17. json=params
  18. )
  19. return response.json()