title: How to resolve CORS error in python flask when connected to angular 6
body: <p>My Flask application has a Agular6 front end. whenever i am executing the below code , i am getting the below error.
  (Angular and flask are connecting over a local network)</p>
  
  <pre><code>import flask
  import main_function as mf
  from flask_cors import CORS,cross_origin
  
  app = flask.Flask(__name__)
  CORS(app)
  app.config["DEBUG"] = True
  
  
  @app.route('/api/v1.0/second_page/&lt;ticker&gt;/&lt;doc_type&gt;/&lt;selection&gt;',methods=['GET'])
  def get_aggregated_past_data_for_selection(ticker,selection,doc_type):
      num_iter = 0
      new_ticker_flag = True
  
      if ticker and doc_type and selection:
          final_value_dict = mf.combine_past_data(ticker,doc_type,selection,num_iter,new_ticker_flag,calling_from='api')
          response = flask.jsonify(final_value_dict)
          response.headers.add('Access-Control-Allow-Origin', 'http://localhost:4200')
          return response
  
      else:
          return flask.jsonify({"Error": “Some fields missing. Please try againr."})
  
  if __name__ == '__main__':
      app.run(host='0.0.0.0')
  </code></pre>
  
  <p>This happens when multiple request are coming one after the other.  For eg. if 5 requests come 2 or 3 requests will be success and others will fail.
  <strong>Is there a limit to the number of request which is being send to flask?</strong>, or can it be because of a new request coming in before the previous one execute?</p>
  
  <blockquote>
    <p><code>Access to XMLHttpRequest at 'http://192.168.1.14:5000/api/v1.0/second_page/AAPL/10-K/24_2_5' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.</code></p>
  </blockquote>