Sportsipy: A free sports API written for python

Sportsipy is a free python API that pulls the stats from and allows them to be easily be used in python-based applications, especially ones involving data analytics and machine learning.

Sportsipy exposes a plethora of sports information from major sports leagues in North America, such as the MLB, NBA, College Football and Basketball, NFL, and NHL. Every sport has its own set of valid API queries ranging from the list of teams in a league, to the date and time of a game, to the total number of wins a team has secured during the season, and many, many more metrics that paint a more detailed picture of how a team has performed during a game or throughout a season.


The following are a few examples showcasing how easy it can be to collect an abundance of metrics and information from all of the tracked leagues. The examples below are only a miniscule subset of the total number of statistics that can be pulled using sportsipy. Visit the documentation on Read The Docs for a complete list of all information exposed by the API.

Get instances of all NHL teams for the 2018 season

from sportsipy.nhl.teams import Teams

teams = Teams(2018)

Get a specific NFL team’s season information

from import Teams

teams = Teams()
lions = teams('DET')

Get a Pandas DataFrame of all stats for a MLB game

from import Boxscore

game = Boxscore('BOS201806070')
df = game.dataframe

Find the number of goals a football team has scored

from import Team

tottenham = Team('Tottenham Hotspur')

Indices and tables