forward.py 420 B

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