def get(self, playerguess): playername = extractOne(playerguess, playerdict)[0] data = fixer([d.__dict__ for d in Players.query.filter_by(PLAYER_NAME=playername)]) return jsonify({playername: data})
def get(self, teamguess): teamname = extractOne(teamguess, teamdict)[0] data = fixer([d.__dict__ for d in Teams.query.filter_by(TEAM_NAME=teamname)]) return jsonify({teamname: data})
def get(self, playerid): if playerid not in playerdict: return jsonify({'ERROR': 'ID NOT FOUND'}) else: data = fixer([d.__dict__ for d in Players.query.filter_by(PLAYER_ID=playerid)]) return jsonify({'Player ID Result': data})
def get(self, teamid): if teamid not in teamdict: return jsonify({'ERROR': 'ID NOT FOUND'}) else: data = fixer([d.__dict__ for d in Teams.query.filter_by(TEAM_ID=teamid)]) return jsonify({'Team ID Result': data})
def get(self): players = fixer([p.__dict__ for p in Players.query.all()]) return jsonify({'NBA Players': players})
def get(self): teams = fixer([t.__dict__ for t in Teams.query.all()]) return jsonify({'NBA Teams': teams})