-
Notifications
You must be signed in to change notification settings - Fork 11
Data Types: People
MattsFace edited this page Dec 29, 2022
·
13 revisions
People are expandable and collapsable - Link to people dataclass
id : int
- People id
link : str
- link to people endpoint
primaryposition : Position
- Person primary position. Dataclass: Position
code: str
- code number of the Position
name: str
- the name of the Position
type: str
- the type of the Position
abbreviation: str
- the abbreviation of the Position
pitchhand : PitchHand
- Person primary position. Dataclass: PitchHand
code : str
- code number of the PitchHand
descritpion: str
- description of the PitchHand
batside : BatSide
- Person's BatSide. Dataclass: BatSide
code : str
- code number of the BatSide
descritpion: str
- description of the BatSide
fullname : str
- full name of the Person
firstname : str
- First name of the Person
lastname : str
- Last name of the Person
primarynumber : str
- Primary number of the Person
birthdate : str
- Birth date of the Person
currentteam : str
- The current Team of the Person
currentage : str
- The current age of the Person
birthcity : str
- The birthcity of the Person
birthstateprovince : str
- The province of the birth state
height : str
- The height of the Person
active : str
- The active status of the Person
usename : str
- The use name of the Person
middlename : str
- The middle name of the Person
boxscorename : str
- The box score name of the Person
nickname : str
- The nickname of the Person
draftyear : str
- The draft year of the Person
mlbdebutdate : str
- The MLB debut date of the Person
namefirstlast : str
- The first and last name of the Person
nameslug : str
- The name slug of the Person
firstlastname : str
- The first and last name of the Person
lastfirstname : str
- The last and first name of the Person
lastinitname : str
- The last and first name of the Person
lastfirstname : str
- The last init name of the Person
initlastname : str
- The init last name of the Person
fullfmlname : str
- The init last name of the Person
initlastname : str
- The full fml name of the Person
fulllfmname : str
- The full lfm name of the Person
uselastname : str
- The last name of the Person
birthcountry : str
- The birth country of the Person
pronunciation : str
- The pronuciation of the Person's name
strikezonetop : str
- The strike zone top of the Person
strikezonebottom : str
- The strike zone bottom of the Person
nametitle : str
- The name title of the Person
gender : str
- The gender of the Person
isplayer : str
- The player status of the Person
isverified : str
- The verification of the Person
namematrilineal : str
- The name matrilineal of the Person
deathdate : str
- The death date of the Person
deathcity : str
- The death city of the Person
deathcountry : str
- The death country of the Person
lastplayeddate : str
- The last played date of the Person
namesuffix : str
- The namesuffix of the Person
Description: Return Person Object from Id
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
person_id |
string/int | Yes | Insert personId for a specific player, coach or umpire based on playerId. |
Description: Return list of all people for sport_id
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
sport_id |
string/int | Yes | Insert a sportId to return player information for a particular sport. For a list of all sportIds: http://statsapi.mlb.com/api/v1/sports | 1 |
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
season |
string/int | Yes | Insert year to return player information for a particular season. | |
gameType |
string | Yes | Insert gameType to return player information for a particular gameType. Find available game types at https://statsapi.mlb.com/api/v1/gameTypes |
Description: Return Person Id(s) from fullname
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
sport_id |
string/int | Yes | Insert a sportId to return player information for a particular sport. For a list of all sportIds: http://statsapi.mlb.com/api/v1/sports | 1 |
fullname |
string | Yes | Search fullname | |
search_key |
string | No | Search key | 'fullname' |
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
season |
string/int | Yes | Insert year to return player information for a particular season. | |
gameType |
string | Yes | Insert gameType to return player information for a particular gameType. Find available game types at https://statsapi.mlb.com/api/v1/gameTypes |
https://statsapi.mlb.com/api/v1/people?personIds=605151
>>> import mlbstatsapi
>>>
>>> mlb = mlbstatsapi.Mlb()
>>>
>>> player = mlb.get_person(player_id = 605151)
>>>
>>> print(player)
Person(id=605151, link=/api/v1/people/605151, primaryposition=Position(code='1', name='Pitcher', type='Pitcher', abbreviation='P'), pitchhand=PitchHand(code='R', description='Right'), batside=BatSide(code='R', description='Right'), fullname=Archie Bradley, firstname=Archie, lastname=Bradley, primarynumber=23, birthdate=1992-08-10, currentage=30, birthcity=Muskogee, birthstateprovince=OK, height="6' 4", weight=215, active=True, usename=Archie, middlename=N., boxscorename=Bradley, nickname=Crash Landing, draftyear=2011, mlbdebutdate=2015-04-11, namefirstlast=Archie Bradley, nameslug=archie-bradley-605151, firstlastname=Archie Bradley, lastfirstname=Bradley, Archie, lastinitname=Bradley, A, initlastname=A Bradley, fullfmlname=Archie N. Bradley, fulllfmname=Bradley, Archie N., birthcountry=USA, pronunciation=BRAD-lee, strikezonetop=3.549, strikezonebottom=1.627, gender=M, isplayer=True, isverified=True, uselastname=Bradley)
>>>
>>>
>>> player_id = mlb.get_people_id("Ty France")
>>> print(player_id)
[664034]
>>>
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.