Skip to content

Examples

This section contains practical code examples demonstrating common use cases with the Griddy SDK.

Python Examples

Quick Reference

Get Games

from griddy.nfl import GriddyNFL

nfl = GriddyNFL(nfl_auth={"accessToken": "token"})
games = nfl.games.get_games(season=2024, season_type="REG", week=1)

Get Player Stats

passing = nfl.stats.passing.get_passing_stats_by_season(season=2024)
rushing = nfl.stats.rushing.get_rushing_stats_by_season(season=2024)
receiving = nfl.stats.receiving.get_receiving_stats_by_season(season=2024)

Get Next Gen Stats

ngs_passing = nfl.ngs.stats.get_passing_stats(season=2024, season_type="REG")
ngs_rushing = nfl.ngs.stats.get_rushing_stats(season=2024, season_type="REG")

Get Box Score

box_score = nfl.games.get_box_score(game_id="game-uuid")

Get Play-by-Play

pbp = nfl.games.get_play_by_play(
    game_id="game-uuid",
    include_penalties=True
)