<reponame>oknono/IDDY
from flask import Flask, render_template, jsonify
from dead_or_alive import Wiki_Person
import requests
import random

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
    dick = Wiki_Person("<NAME>")
    dick_dead = dick.is_dead()

    dead_text = ["<NAME> is Dead!", "Dick is still dead", "<NAME> is no longer alive",
                 "<NAME> has seized to be", "Yes, <NAME> is dead",
                 "Yes, <NAME> is Dead!", "Yes, Dick is still dead", "No, <NAME> is no longer alive",
                 "Yes, <NAME> has seized to be", "Yes, <NAME> is dead"]
    alive_text = ["<NAME> is not dead yet...", "<NAME> is still alive",
                  "<NAME> is still breathing", "<NAME> is not dead",
                  "No, <NAME> is not dead yet...",
                  "Yes, yes, <NAME> is still breathing", "No, <NAME> is not dead"]
    if dick_dead:
        name = "dead"
        result= dead_text[random.randrange(len(dead_text))]
    else:
        name = "alive"
        result = alive_text[random.randrange(len(alive_text))]
    return render_template('index.html', name=name, result=result )

@app.route('/api', methods=['GET'])
def get_dick():
    dick = Wiki_Person("<NAME>")
    dick_dead = dick.is_dead()
    return jsonify({'dick_is_dead': dick_dead})

if __name__ == '__main__':
    app.run()

from flask import Flask, render_template, jsonify
from dead_or_alive import Wiki_Person
import requests
import random

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
    dick = Wiki_Person("<NAME>")
    dick_dead = dick.is_dead()

    dead_text = ["<NAME> is Dead!", "Dick is still dead", "<NAME> is no longer alive",
                 "<NAME> has seized to be", "Yes, <NAME> is dead",
                 "Yes, <NAME> is Dead!", "Yes, Dick is still dead", "No, <NAME> is no longer alive",
                 "Yes, <NAME> has seized to be", "Yes, <NAME> is dead"]
    alive_text = ["<NAME> is not dead yet...", "<NAME> is still alive",
                  "<NAME> is still breathing", "<NAME> is not dead",
                  "No, <NAME> is not dead yet...",
                  "Yes, yes, <NAME> is still breathing", "No, <NAME> is not dead"]
    if dick_dead:
        name = "dead"
        result= dead_text[random.randrange(len(dead_text))]
    else:
        name = "alive"
        result = alive_text[random.randrange(len(alive_text))]
    return render_template('index.html', name=name, result=result )

@app.route('/api', methods=['GET'])
def get_dick():
    dick = Wiki_Person("<NAME>")
    dick_dead = dick.is_dead()
    return jsonify({'dick_is_dead': dick_dead})

if __name__ == '__main__':
    app.run()