-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFirst Flask.py
50 lines (41 loc) · 1.27 KB
/
First Flask.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
38
39
40
41
42
43
44
45
46
47
48
49
50
import random
from time import sleep
from flask import Flask, redirect, url_for, render_template, request
import pyautogui as pg
import webbrowser as wb
app = Flask(__name__)
@app.route("/home")
@app.route("/")
def home():
return render_template("index.html")
@app.route("/<name>")
@app.route("/<name>/")
@app.route("/<name>/<surname>")
def user(name, surname=""):#document.querySelector("#para")//*[@id="para"]/html/body/div/p[3]/html/body/div/p[2]
return render_template("user.html", content=F"{name} & {surname}")
print("Done!")
@app.route("/search", methods=['GET'])
def search():
args = request.args
return str(args.to_dict()) + str(args.get("query"))
@app.route("/data")
def dataSend():
return "DATA!!"
@app.route("/info", methods=['POST'])
def infoRecieve():
jsonFile = request.get_json(cache=True)
print(jsonFile)
print(jsonFile['name'], jsonFile['age'])
return "jsonFile"
@app.route(f"/Damn it's him/{random.random()}")
def specialUser():
return render_template("user.html", content="Holy Admin!")
@app.route("/admin/")
def admin():
return redirect(url_for("specialUser"))
@app.route("/about")
def about():
return render_template("about.html")
if __name__ == "__main__":
# wb.open("http://127.0.0.1:5000")
app.run(debug=True)