-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_code.py
28 lines (19 loc) · 895 Bytes
/
main_code.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
from flask import Flask, render_template, request
from app import buscar_jogador
app = Flask(__name__, template_folder='templates')
@app.route("/")
def home():
return render_template('index.html', value='')
@app.route("/busca", methods=['POST', 'GET'])
def busca():
NAME_PLAYER = request.args.get('name')
TEAM_PLAYER = request.args.get('team')
name, age, club, position, market_value = buscar_jogador(NAME_PLAYER, TEAM_PLAYER)
string_sender = name + ','
if string_sender == ',':
string_return = 'Informações não encontradas'
else:
string_return = name + ', jogador do: ' + club + ' possui: ' + age + ' anos' + ', joga de: ' + position + ' e seu valor de mercado é: ' + market_value
return render_template('index.html', value=string_return)
if __name__ == "__main__":
app.run(debug=True, port=5000)