I am new to python and I'm trying to implement a rest api in python using flask framework. The goal is when the api is called, I want to implement some logic that will execute a python script and return that output as the API response to the client.
Here what I have for my simple rest service
hello.py
from flask import Flask
app = Flask(__name__)
@app.route("/tasks")
def get_tasks():
return "return json output"
python script that I would like to be called and executed mypythonscript.py
print("My first simple Python script!")
Ultimately, I'll get the script output whenever I call the rest API. Is this possible? any pointers or documentation/resources or examples of something similar would greatly help!