<filename>redirectangular/src/app.py
#Import dependencies
from flask import Flask, render_template, request
import requests


#Create instance of Flask App
app = Flask(__name__)

#Define Route and Content of that page
@app.route("/")
def home():
    return render_template("index.html")

@app.route("/detect")
def detect_redirects():
    url = request.args.get('url')
    r = requests.get(url)
    str_response = ''
    for i, response in enumerate(r.history, 1):
        print(i, response.url)
        str_response += str(i) + ' ' + response.url + '<br/>'

    # print ("redirects to   {}   with a status code of   {}  ".format(r.url,r.status_code))
    str_response += ("redirects to   {}   with a status code of   {}  ".format(r.url,r.status_code))
    
    return str_response

#Define route 2 and content


#Define route 3 and content


#Running and Controlling the script
if (__name__ =="__main__"):
    app.run(host='0.0.0.0', port=5000)