title: Creating an API to execute a python script
body: <p>I have a python script <strong>app.py</strong> in my local server (<strong>path</strong>=Users/soubhik.b/Desktop) that generates a report and mails it to certain receivers. Instead of scheduling this script on my localhost, i want to create an API which can be accessed by the receivers such that they would get the mail if they hit the API with say a certain id.
  With the below code i can create an API to display a certain text. But, what do i modify to run the script through this?
  Also if i want to place the script in a server instead of localhost, how do i configure the same?</p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  
  @app.route("/")
  def hello():
      return ("hello world")
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p><strong>Python Version is 2.7</strong></p>