title: I had a flask api . Whoever uses this api i should limit their calls by tracking their ip address using flask and python
body: <p>I had an API ,whoever hits this API I should limit their calls <strong>by tracking their IP address</strong>.If one user hits my API for the second time ,I should decrease their calls.They can hit my API from mobile or system whatever it may be.Using flask and python ,Please give me any suggestion or tutorial.Thanks in advance.</p>
  
  <p>I tried this code but I am able to track only their public IP ,I want their local IP  along with public IP.</p>
  
  <pre><code>@app.route('/api.text-services/sentiment', methods=['GET'])
  @cross_origin()
  def Demoapi():
       ipaddress=request.remote_addr
  
  Result:106.XX.XX.XX(Public IP)
  
  app.wsgi_app = ProxyFix(app.wsgi_app)
  @app.route('/api.text-services/sentiment', methods=['GET'])
  @cross_origin()
  def Demoapi():
  
      ipaddress=request.environ.get('HTTP_X_REAL_IP', request.remote_addr)
  </code></pre>
  
  <p>Result:106.XX.XX.XX(public IP)</p>
  
  <pre><code>@app.route('/api.text-services/sentiment', methods=['GET'])
  @cross_origin()
  def Demoapi():
      ipaddress=origin=request.headers.get('X-Forwarded-For', request.remote_addr)
  </code></pre>
  
  <p>Result:106.XX.XX.XX(public IP)</p>
  
  <p>I expect the result as 106.XX.XX.XX(public IP)_10.0.XX.XXX(local IP) using flask and python.From which system the user hits my API I should be able to track the Public IP and Local IP of that system using flask and python.</p>