Closed Lnk2past closed 3 years ago
127.0.0.1
is typically used as a local "loop-back" address and is only visible to the system it's running on. So if your Raspberry pi is running the flask server another software running on that same pi could successfully reach the web server at this address, but anything not running specifically on that raspberry pi would not be able to see that address you'll need to find the visible IP for the Raspberry pi and use that on the micro-controller / air-lift in order to successfully reach it.
You can try running the command ip addr
on the raspberry pi and see if you can find which ip is visible to the rest of the network it tends to be something like 192.168.1.[something]
in most default setups but depends entirely on the network infrastructure in use. Once you find the Pi's visible IP then you should be able to use that instead of 127.0.0.1
on the micro-controller / air-lift device to get a successful connection.
Hi there, thanks for the reply!
I will give that a try when I get home, but I figured it would have been OK with 127.0.0.1
since I ran the flask server with the host set to 0.0.0.0
(I should have noted that in my original post). I am able to hit it with Postman from my PC (not the pi) (I should have noted this too lol).
I will at least try with the actual network address and will report back.
I am still confused how my PC was able to hit the API at 127.0.0.1
, especially since I was running my flask app incorrectly. Everything is working as expected now, thanks for getting me oriented in the right direction!
All library versions are from the
adafruit-circuitpython-bundle-6.x-mpy-20210612
bundle.adafruit_apds9960
adafruit_ble
adafruit_bluefruit_connect
adafruit_bus_device
adafruit_esp32spi
adafruit_lsm6ds
adafruit_register
adafruit_bmp280.mpy
adafruit_lis3mdl.mpy
adafruit_requests.mpy
adafruit_sht31d.mpy
neopixel.mpy
Not sure if this is the correct project to report this in.
I just set up a Feather nRF52840 Sense with an AirLift FeatherWing, and while all of the example code works (all of this works), I am having some issues trying to set up something a little more custom.
I am running into an issue sending a request to a local IP. I am running a flask server from a Raspberry Pi with a simple GET endpoint exposed. The endpoint works perfectly fine when hitting it with Postman, but when trying to hit it using
adafruit_esp32spi
, I receive an odd error. I tried digging into the source here as well as inadafruit_requests
, but I couldn't figure anything out.My simple flask server (ultimately running at
http://127.0.0.1:5000
with the endpointboop
):Code I am running on the Sense/Airlift:
And here is the output when I run everything (networks redacted):
Thanks in advance for any information, insight, or help!