-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (30 loc) · 848 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import time
from flask import Flask, request, render_template, jsonify, make_response
from poemBot import getURL, getbs4Poems
app = Flask(__name__, template_folder="templates")
@app.route("/")
def index():
# title, author, poem, years, url = tap()
bs4poem = getbs4Poems()
title, author, date, poem, url = (
bs4poem[0],
bs4poem[1],
bs4poem[2],
bs4poem[3],
bs4poem[4],
)
# [title, author, date, poem, url]
headers = {"Content-Type": "text/html"}
return make_response(
render_template(
"index.html", title=title, author=author, date=date, poem=poem, url=url
),
200,
headers,
)
@app.route("/time")
def get_current_time():
return {"time": time.time()}
@app.route("/api/about")
def about():
return "This is the about page"