-
Notifications
You must be signed in to change notification settings - Fork 11
Data Types: Division
MattsFace edited this page Dec 29, 2022
·
8 revisions
Attributes are expandable and collapsable - Link to Division dataclass
id : int
- id number of the divison
name : str
- name of the division
link : str
- link of the division
season : str
- Current season for the division
nameshort : str
- Short name for the division
abbreviation : str
- Abbreviation of the divison name
league : League
- League this division is in. Dataclass: League
id : int
- id number of the league
link : str
- link of the league
sport : Sport
- Sport this divison is in. Dataclass: Sport
id : int
- id number of the sport
link : str
- link of the sport
haswildcard : bool
- If this league has a wildcard
sortorder : int
- Sort order
numplayoffteams : int
- Number of playoff teams in division
active : bool
- Current status of this division
Description: Returns a Division
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
divison_id |
string/int | Yes | divisionId to return a directory of division(s) for a specific division. | None |
Description: Return all divisons
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
divisionId |
string/int | No | Insert divisionId(s) to return a directory of division(s) for a specific division. Format '200,201' | None |
leagueId |
string/int | No | Insert leagueId to return a directory of division(s) for all divisions in a specific league. | None |
sportId |
string/int | No | Insert a sportId to return a directory of division(s) for all divisions in a specific sport. | None |
Description: Return division ids
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
division_name |
string | Yes | Division name |
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
search_key |
string | No | description | 'name' |
https://statsapi.mlb.com/api/v1/divisions?divisionId=200&leagueId=103&sportId=1
>>> import mlbstatsapi
>>>
>>> mlb = mlbstatsapi.Mlb()
>>>
>>> division_ids = mlb.get_division_id("American League West")
>>>
>>> print(division_ids)
[200]
>>>
>>>
>>> division = mlb.get_division(division_id = 200, leagueId = 103, sportId = 1)
>>>
>>> print(division)
Division(id=200, link=/api/v1/divisions/200, name=American League West, season=2022, nameshort=AL West, abbreviation=ALW, league=League(id=103, link=/api/v1/league/103), sport=Sport(id=1, link=/api/v1/sports/1), haswildcard=False, sortorder=24, numplayoffteams=1, active=True)
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.