So I have a development Flask application running on my local computer. I can reach it at http://127.0.0.1:5000 or http://localhost:5000. Sending an HTTP request to this server from the script console works fine. When I put the exact same code into a button in a Perspective session it seems to route the request to the server Ignition is hosted on. This occurs in both the designer and in browser.
Is there a way to route it localhost on the host computer? I assume not, as it seems to be doing all the code logic server side.
Heres example code, if you need it.
client = system.net.httpClient(bypass_cert_validation=True) response = client.post('http://127.0.0.1:5000/ping') # Validate the response if response.good: # Do something with the response print response.text