diff --git a/src/__pycache__/boxscores.cpython-310.pyc b/src/__pycache__/boxscores.cpython-310.pyc new file mode 100644 index 0000000..75b1d7a Binary files /dev/null and b/src/__pycache__/boxscores.cpython-310.pyc differ diff --git a/src/boxscores.py b/src/boxscores.py new file mode 100644 index 0000000..99a96ad --- /dev/null +++ b/src/boxscores.py @@ -0,0 +1,22 @@ +from nba_api.stats.endpoints import boxscoretraditionalv2 +from nba_api.stats.static import teams +from nba_api.stats.endpoints import leaguegamefinder + +def boxscores_For_Latest_Game(): + + nba_teams = teams.get_teams() + # Select the dictionary for the Celtics, which contains their team ID + kings = [team for team in nba_teams if team['abbreviation'] == 'SAC'][0] + kings_id = kings['id'] + + + # Query for games where the Celtics were playing + gamefinder = leaguegamefinder.LeagueGameFinder(team_id_nullable=kings_id) + # The first DataFrame of those returned is what we want. + games = gamefinder.get_data_frames()[0] + games.head() + + + boxScore = boxscoretraditionalv2.BoxScoreTraditionalV2(games.head()["GAME_ID"][0]) + + return(boxScore.get_dict()) diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..5ce2876 --- /dev/null +++ b/src/index.html @@ -0,0 +1,55 @@ + + + + + + BANG + + + + + +

TABLE

+ + + + + + + + + + + + +
PlayerFGMFGA
+ + + \ No newline at end of file diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..3740e07 --- /dev/null +++ b/src/main.py @@ -0,0 +1,14 @@ +import boxscores +from flask import Flask, jsonify +from flask_cors import CORS + +app = Flask(__name__) +CORS(app) + +@app.route("/boxscore") +def names(): + return jsonify(boxscores.boxscores_For_Latest_Game()) + +if __name__ == "__main__": + app.run(debug=True) + diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000..0c3d82e --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,2 @@ +nba_api +flask \ No newline at end of file