title: Calling REST API of a Flask app from another Flask app
body: <p>I'm running two Flask apps (A &amp; B) on my local machine. In Flask app B, I'm calling an endpoint from Flask app A.</p>
  
  <p>The endpoint being called from Flask app A is: <code>/hello_world</code></p>
  
  <pre><code>from flask import Flask, jsonify, request
  
  app = Flask(__name__)
  
  @app.route("/hello_world", methods=["POST"])
  def hello_world():
       a = request.json.get("a")
       b = request.json.get("b")
       return jsonify({a:b})
  
  if __name__ == '__main__':
      app.run(host='0.0.0.0',port=5000,debug=True)
  </code></pre>
  
  <p>In flask app B, the endpoint <code>/hi_world</code> is making a call to the above endpoint as follows:</p>
  
  <pre><code>import requests
  from flask import Flask, jsonify, request
  
  app = Flask(__name__)
  
  @app.route("/hi_world", methods=["POST"])
  def hi_world():
       a = request.json.get("a")
       b = request.json.get("b")
       paras = {"a":a, "b":b}
       response = requests.post(url="http://0.0.0.0:5000/",data=paras)
       print(response)
       return None
  
  if __name__ == '__main__':
      app.run(host='0.0.0.0',port=5002,debug=True)
  </code></pre>
  
  <p>I use postman to make a POST call to the <code>/hi_world</code> where I pass the following dictionary in the request body <code>{"a":"Hello","b":"World"}</code>. However, I get a <code>&lt;Response [404]&gt;</code>. When I call the <code>/hello_world</code> directly from postman it works just fine with a <code>&lt;Response [200]&gt;</code>. What am I doing wrong?</p>