First Code Commit
This commit is contained in:
8
Flask App/ARG/agent.py
Normal file
8
Flask App/ARG/agent.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--x', type=int, required=True)
|
||||
parser.add_argument('--y', type=int, required=True)
|
||||
args = parser.parse_args()
|
||||
product = args.x * args.y
|
||||
print(f"{args.x} * {args.y} = {product}")
|
||||
19
Flask App/app.py
Normal file
19
Flask App/app.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from flask import Flask, render_template, request
|
||||
import requests
|
||||
|
||||
SERVER_URL = "http://127.0.0.1:8000"
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
def loginGET():
|
||||
return render_template("login.html")
|
||||
|
||||
@app.route("/", methods=["POST"])
|
||||
def loginPOST():
|
||||
username = request.form["username"]
|
||||
password = request.form["password"]
|
||||
response = requests.get( f"{SERVER_URL}/login?username={username}&password={password}")
|
||||
return render_template("succes.html", data = response.content)
|
||||
|
||||
app.run()
|
||||
0
Flask App/main.py
Normal file
0
Flask App/main.py
Normal file
17
Flask App/templates/login.html
Normal file
17
Flask App/templates/login.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post">
|
||||
<label>Username:</label>
|
||||
<input type="text" name="username">
|
||||
<label>Password:</label>
|
||||
<input type="password" name="password">
|
||||
<input type="submit" value="Login">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
11
Flask App/templates/succes.html
Normal file
11
Flask App/templates/succes.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>{{data}}</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user