I'm using python to make 2 APIs communicate between them, i made tests and both APIs work fine on their own, the problem arises when i try to send a request to API A (made with flask) so A can pass the data to API B(made with django) and then return the result to A again.
When i try to test this endpoint, the response is:
HTTPConnectionPool(host='0.0.0.0', port=7000): Max retries exceeded with url: /verify?0 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa0b939df50>: Failed to establish a new connection: [Errno 111] Connection refused'))
The test file and the manual test fail in this way, if i make a request to API B with the url that API A is making it returns a ok message.
I'm thinking i'm missing something about the config in API B, but where? and what?
Brief Summary:
API A it's made in flask and run locally in a dock container
API B it's made with django and has has ALLOWED_HOSTS = ["*"] in the config file settings.py adn running locally too
When i make a request to API A to call API B, B never register any event in the console log but API B calling to API A the request goes thru succesfully
It turns out that I was trying to connect from the docker API with a 0.0.0.0:port
and localhost:port
, I only needed to use my public IP.
To access the server from itself, use http://localhost/ or http://127.0.0.1/.
You can also use http://192.168.X.X to access it from a device on the same network.
You need to get your public IP address, which you can find using ipconfig
command on Windows machine.
Then, you can try like this:
http://<public_ip>:<your_port>/
It will show you the server welcome page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With