-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
31 lines (25 loc) · 1.03 KB
/
app.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
from methods import userDetails, convertUnixTime, getTags, contestDetails
from flask import Flask,render_template,request
app=Flask(__name__)
@app.route("/")
def index():
return render_template("login.html",give_error=False)
@app.route("/login",methods=["GET","POST"])
def login():
userInfo = False
if request.method=="POST":
user=request.form['username']
userInfo = userDetails(user, False)
if(userInfo == False):
return render_template('login.html',give_error=True)
if 'rating' not in userInfo:
return render_template('login.html',usererror=True)
dt_object = convertUnixTime(userInfo['lastOnlineTimeSeconds'])
weakTags = getTags(userInfo['handle'], userInfo['rating'])
return render_template('profile.html', user=userInfo, lastOnline=dt_object, tags= weakTags)
@app.route("/contests",methods=["GET","POST"])
def contests():
contestsList = contestDetails()
return render_template('future_contests.html', contests= contestsList)
if __name__=="__main__":
app.run(debug=True)