Flask

Easy web service with flask

First install flask via pip or apt-get, then import the necessary packages into your project:

from flask import Flask, request, json

Now an app taht is going to be served via flask needs to serve a certain function to an url, so you first start by creating a Flask class instance:

app = Flask(__name__)

To create a new function, use:

@app.route("/example", methods = ['GET','POST'])

Then you can define your function below the @ line, just like any function, it’s return is going to be the answer to the POST call.