-
Notifications
You must be signed in to change notification settings - Fork 11
Data Types: Schedule
MattsFace edited this page Dec 29, 2022
·
4 revisions
Attributes are expandable and collapsable - Link to Schedule dataclass
totalitems : int
- Total items in schedule
totalevents : int
- Total events in schedule
totalgames : int
- Total games in schedule
totalgamesinprogress : int
- Total games in progress in schedule
dates : ScheduleDates
- List of dates with games in schedule. Dataclass: ScheduleDates
date : str
- Date for the group of games
totalitems : int
- Total amount of items for this date
totalevents : int
- The number of events for this date
totalgames : int
- The number of games for this date
totalgamesinprogress : int
- The number of games that are currently in progress for this date
games : List[ScheduleGames]
- A list of games for this date. Dataclass: ScheduleGames
gamepk : int
- The games id number
link : str
- The link for this game
gametype : str
- This games game type
season : str
- The season this game takes place in
gamedate : str
- The date for this game
officialdate : str
- The official date for this game
status : GameStatus
- The status of this game. Dataclass: GameStatus
abstractgamestate : str
- The abstract game state
codedgamestate : str
- The coded game state
detailedstate : str
- The detailed game state
statuscode : str
- Status code for this game
starttimetbd : bool
- If the start time is TBD
abstractgamecode : str
- The abstract game code
reason : str
- reason for a state. Usually used for delays or cancellations
teams : ScheduleHomeAndAway
- Holds teams and thier info for this game. Dataclass: ScheduleHomeAndAway
home : ScheduleGameTeam
- Home team info for this game. Dataclass: ScheduleGameTeam
leaguerecord : LeagueRecord
- League record for this team. Dataclass: LeagueRecord
wins : int
- number of wins in leaguerecord
losses : int
- number of losses in leaguerecord
ties : int
- number of ties in leaguerecord
pct : str
- winning pct of leaguerecord
score : int
- Current score for this team in this game
team : Team
- Team info for this game. Dataclass: ScheduleGameTeamInfo
id : int
- Team id
name : str
- The teams name
link : str
- The link for this team
iswinner : bool
- If this team is the winner of this game
splitsquad : bool
- Split squad
seriesnumber : int
- Series number
away : ScheduleGameTeam
- Away team info for this game. Dataclass: ScheduleGameTeam
leaguerecord : LeagueRecord
- League record for this team. Dataclass: LeagueRecord
wins : int
- number of wins in leaguerecord
losses : int
- number of losses in leaguerecord
ties : int
- number of ties in leaguerecord
pct : str
- winning pct of leaguerecord
score : int
- Current score for this team in this game
team : Team
- Team info for this game. Dataclass: ScheduleGameTeamInfo
id : int
- Team id
name : str
- The teams name
link : str
- The link for this team
iswinner : bool
- If this team is the winner of this game
splitsquad : bool
- Split squad
seriesnumber : int
- Series number
venue : Venue
- The venue this game takes place in. Dataclass: Venue
id : int
- id for this venue
name : str = None
- Name for this venue
link : str
- Link to venues endpoint
content : dict
- Content for this game. Havent found a populated reference yet. Stays as dict
istie : bool
- If this game is a tie
gamenumber : int
- Game number for this game
publicfacing : bool
- Is this game public facing
doubleheader : str
- The double header status for this game, "n','y'?
gamedaytype : str
- The type of gameday for this game
tiebreaker : str
- Tie breaker for this game, 'n','y'?
calendareventid : str
- Calender event Id for this game
seasondisplay : str
- Displayed season for this game
daynight : str
- Day or night game as a string, 'am','pm'?
scheduledinnings : int
- Number of scheduled inning for the game
reversehomeawaystatus : bool
- If reverse home and away?
inningbreaklength : int
- Length of break between innings
gamesinseries : int
- Number of games in current series
seriesgamenumber : int
- Game number in the current series
seriesdescription : str
- Description of this current series
recordsource : str
- Record source
ifnecessary : str
- If necessary
ifnecessarydescription : str
- If necessary description
rescheduledate : str
- If game is rescheduled, this is the rescheduled date
reschedulegamedate : str
- rescheduled game date
rescheduledfrom : str
- rescheduled from
rescheduledfromdate : str
- rescheduled from date
istie : bool
- Is tie
events : list
- A list of events for this date. Need to handle this but cant find a populated reference for this object. It stays as a list for now.
Description: Returns a schedule object
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
date |
string | Yes | Date | |
start_date |
string | Yes | Start date "yyyy-mm-dd" | |
end_date |
string | Yes | End date "yyyy-mm-dd" | |
sport_id |
string/int | Yes | Sport ID of schedule | 1 |
team_id |
string/int | No | Team ID of schedule |
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
leagueId |
string | Yes | Insert leagueId to return all schedules based on a particular scheduleType for a specific league | |
gamePks |
string | Yes | Insert gamePks to return all schedules based on a particular scheduleType for specific games. | |
venueIds |
string | Yes | Insert venueId to return all schedules based on a particular scheduleType for a specific venueId. | |
gameTypes |
string | Yes | Insert gameTypes to return schedule information for all games in particular gameTypes. For a list of all gameTypes: https://statsapi.mlb.com/api/v1/gameTypes |
https://statsapi.mlb.com/api/v1/schedule?sportId=1
>>> import mlbstatsapi
>>>
>>> mlb = mlbstatsapi.Mlb()
>>>
>>> schedule = mlb.get_schedule('2022-10-13')
>>>
>>> print(schedule)
Schedule(totalitems=2, totalevents=0, totalgames=2, totalgamesinprogress=0, dates=[ScheduleDates(date=2022-10-13, totalgames=2)])
>>>
>>> dates = schedule.dates
>>> for date in dates:
... for game in date.games:
... print(game.teams.home)
... print(game.teams.away)
...
ScheduleGameTeam(gamepk=LeagueRecord(wins=2, losses=0, pct='1.000', ties=None), team=Team(id=117, link=/api/v1/teams/117, name=Houston Astros))
ScheduleGameTeam(gamepk=LeagueRecord(wins=0, losses=2, pct='.000', ties=None), team=Team(id=136, link=/api/v1/teams/136, name=Seattle Mariners))
ScheduleGameTeam(gamepk=LeagueRecord(wins=1, losses=1, pct='.500', ties=None), team=Team(id=147, link=/api/v1/teams/147, name=New York Yankees))
ScheduleGameTeam(gamepk=LeagueRecord(wins=1, losses=1, pct='.500', ties=None), team=Team(id=114, link=/api/v1/teams/114, name=Cleveland Guardians))
Note: This information is provided for reference only, without warranty or guarantee, and is not official documentation provided by MLB. This package and its author are not affiliated with MLB or any MLB team. This API wrapper interfaces with MLB's Stats API. Use of MLB data is subject to the notice posted at http://gdx.mlb.com/components/copyright.txt.