{"id":34080102,"url":"https://github.com/zero-sum-seattle/python-mlb-statsapi","last_synced_at":"2026-04-09T00:02:27.477Z","repository":{"id":59498602,"uuid":"535875567","full_name":"zero-sum-seattle/python-mlb-statsapi","owner":"zero-sum-seattle","description":"Python Wrapper for the MLB's Official Stats API","archived":false,"fork":false,"pushed_at":"2026-02-05T05:39:47.000Z","size":1889,"stargazers_count":72,"open_issues_count":2,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-05T17:46:55.868Z","etag":null,"topics":["api-wrapper","baseball-data","baseball-statistics","mlb","mlb-endpoints","mlb-game","mlb-gameday","mlb-scores","mlb-stats","mlb-stats-api","python","python-wrapper","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zero-sum-seattle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-09-12T22:44:16.000Z","updated_at":"2026-02-05T05:39:51.000Z","dependencies_parsed_at":"2022-09-18T04:13:01.888Z","dependency_job_id":"54ad2bef-daa8-4e1b-8bf4-b1b6367fa0a2","html_url":"https://github.com/zero-sum-seattle/python-mlb-statsapi","commit_stats":{"total_commits":36,"total_committers":4,"mean_commits":9.0,"dds":0.5277777777777778,"last_synced_commit":"9f289b2db384312aabd7691bdf28a5e5a480f928"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zero-sum-seattle/python-mlb-statsapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-sum-seattle%2Fpython-mlb-statsapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-sum-seattle%2Fpython-mlb-statsapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-sum-seattle%2Fpython-mlb-statsapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-sum-seattle%2Fpython-mlb-statsapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zero-sum-seattle","download_url":"https://codeload.github.com/zero-sum-seattle/python-mlb-statsapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-sum-seattle%2Fpython-mlb-statsapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31579058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","baseball-data","baseball-statistics","mlb","mlb-endpoints","mlb-game","mlb-gameday","mlb-scores","mlb-stats","mlb-stats-api","python","python-wrapper","python3"],"created_at":"2025-12-14T11:43:55.596Z","updated_at":"2026-04-09T00:02:27.471Z","avatar_url":"https://github.com/zero-sum-seattle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Python MLB Stats API\n\n**The Unofficial Python Wrapper for the MLB Stats API**\n\n[![PyPI version](https://badge.fury.io/py/python-mlb-statsapi.svg)](https://badge.fury.io/py/python-mlb-statsapi)\n![Development Branch Status](https://github.com/zero-sum-seattle/python-mlb-statsapi/actions/workflows/build-and-test-mlbstatsapi-test.yml/badge.svg?event=push)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-mlb-statsapi)\n![GitHub](https://img.shields.io/github/license/zero-sum-seattle/python-mlb-statsapi)\n\n\u003cdiv align=\"left\"\u003e\n\n### *Copyright Notice*  \nThis package and its authors 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.\n\n###### This is an educational project - Not for commercial use. \n\n\n![MLB Stats API](https://user-images.githubusercontent.com/2068393/203456246-dfdbdf0f-1e43-4329-aaa9-1c4008f9800d.jpg)\n\n## Getting Started\n\n*Python-mlb-statsapi* is a Python library that provides access to the MLB Stats API, allowing developers to retrieve information related to MLB teams, players, stats, and more. Written in Python 3.10+.\n\nAll models are built with [Pydantic](https://docs.pydantic.dev/) for robust data validation and serialization. Field names follow Python's `snake_case` convention for a more Pythonic experience.\n\nFor detailed documentation, check out the [Wiki](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki) which contains information on return objects, endpoint structure, usage examples, and more.\n\n\n\u003cdiv align=\"center\"\u003e\n\n### [Examples](#examples) | [Wiki](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki) | [API](https://statsapi.mlb.com/) \n\n\u003cdiv align=\"left\"\u003e\n\n## Installation\n```python\npython3 -m pip install python-mlb-statsapi\n```\n\n## Quick Start\n```python\n\u003e\u003e\u003e import mlbstatsapi\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\n\u003e\u003e\u003e mlb.get_people_id(\"Ty France\")\n[664034]\n\n\u003e\u003e\u003e player = mlb.get_person(664034)\n\u003e\u003e\u003e print(player.full_name)\nTy France\n\n\u003e\u003e\u003e stats = ['season', 'seasonAdvanced']\n\u003e\u003e\u003e groups = ['hitting']\n\u003e\u003e\u003e params = {'season': 2022}\n\u003e\u003e\u003e mlb.get_player_stats(664034, stats, groups, **params)\n{'hitting': {'season': Stat, 'seasonAdvanced': Stat }}\n\n\u003e\u003e\u003e mlb.get_team_id(\"Seattle Mariners\")\n[136]\n\n\u003e\u003e\u003e team = mlb.get_team(136)\n\u003e\u003e\u003e print(team.name, team.franchise_name)\nSeattle Mariners Seattle\n```\n\n## Working with Pydantic Models\n\nAll returned objects are Pydantic models, giving you access to powerful serialization and validation features.\n\n### Convert to Dictionary\n```python\n\u003e\u003e\u003e player = mlb.get_person(664034)\n\u003e\u003e\u003e player.model_dump()\n{'id': 664034, 'full_name': 'Ty France', 'link': '/api/v1/people/664034', ...}\n\n# Exclude None values\n\u003e\u003e\u003e player.model_dump(exclude_none=True)\n{'id': 664034, 'full_name': 'Ty France', 'link': '/api/v1/people/664034', ...}\n\n# Include only specific fields\n\u003e\u003e\u003e player.model_dump(include={'id', 'full_name', 'primary_position'})\n{'id': 664034, 'full_name': 'Ty France', 'primary_position': Position(...)}\n```\n\n### Convert to JSON\n```python\n\u003e\u003e\u003e player = mlb.get_person(664034)\n\u003e\u003e\u003e player.model_dump_json()\n'{\"id\": 664034, \"full_name\": \"Ty France\", \"link\": \"/api/v1/people/664034\", ...}'\n\n# Pretty print with indentation\n\u003e\u003e\u003e print(player.model_dump_json(indent=2))\n{\n  \"id\": 664034,\n  \"full_name\": \"Ty France\",\n  \"link\": \"/api/v1/people/664034\",\n  ...\n}\n```\n\n### Access Fields with Snake Case Names\n```python\n\u003e\u003e\u003e player = mlb.get_person(664034)\n\u003e\u003e\u003e player.full_name          # Not fullName\n'Ty France'\n\u003e\u003e\u003e player.primary_position   # Not primaryPosition\nPosition(code='3', name='First Base', ...)\n\u003e\u003e\u003e player.bat_side           # Not batSide  \nCodeDesc(code='R', description='Right')\n```\n\n## Documentation\n\n### [People, Person, Players, Coaches](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-People)\n* `Mlb.get_people_id(self, fullname: str, sport_id: int = 1, search_key: str = 'fullname', **params)` - Return Person Id(s) from fullname\n* `Mlb.get_person(self, player_id: int, **params)` - Return Person Object from Id\n* `Mlb.get_people(self, sport_id: int = 1, **params)` - Return all Players from Sport\n### [Draft](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Draft(round))\n* `Mlb.get_draft(self, year_id: int, **params)` - Return a draft for a given year\n### [Awards](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Award)\n* `Mlb.get_awards(self, award_id: int, **params)` - Return award recipients for a given award\n### [Teams](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Team)\n* `Mlb.get_team_id(self, team_name: str, search_key: str = 'name', **params)` - Return Team Id(s) from name\n* `Mlb.get_team(self, team_id: int, **params)` - Return Team Object from Team Id\n* `Mlb.get_teams(self, sport_id: int = 1, **params)` - Return all Teams for Sport\n* `Mlb.get_team_coaches(self, team_id: int, **params)` - Return coaching roster for team for current or specified season\n* `Mlb.get_team_roster(self, team_id: int, **params)` - Return player roster for team for current or specified season\n### [Stats](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Stats)\n* `Mlb.get_player_stats(self, person_id: int, stats: list, groups: list, **params)` - Return stats by player id, stat type and groups\n* `Mlb.get_team_stats(self, team_id: int, stats: list, groups: list, **params)` - Return stats by team id, stat types and groups\n* `Mlb.get_stats(self, stats: list, groups: list, **params: dict)` - Return stats by stat type and group args\n* `Mlb.get_players_stats_for_game(self, person_id: int, game_id: int, **params)` - Return player stats for a game\n### [Gamepace](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Gamepace)\n* `Mlb.get_gamepace(self, season: str, sport_id=1, **params)` - Return pace of game metrics for specific sport, league or team.\n### [Venues](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Venue)\n* `Mlb.get_venue_id(self, venue_name: str, search_key: str = 'name', **params)` - Return Venue Id(s)\n* `Mlb.get_venue(self, venue_id: int, **params)` - Return Venue Object from venue Id\n* `Mlb.get_venues(self, **params)` - Return all Venues\n### [Sports](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Sport)\n* `Mlb.get_sport(self, sport_id: int, **params)` - Return a Sport object from Id\n* `Mlb.get_sports(self, **params)` - Return all Sports\n* `Mlb.get_sport_id(self, sport_name: str, search_key: str = 'name', **params)`- Return Sport Id from name\n### [Schedules](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Schedule)\n* `Mlb.get_schedule(self, date: str, start_date: str, end_date: str, sport_id: int, team_id: int, **params)` - Return a Schedule\n### [Divisions](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Division)\n* `Mlb.get_division(self, division_id: int, **params)` - Return a Division \n* `Mlb.get_divisions(self, **params)` - Return all Divisions\n* `Mlb.get_division_id(self, division_name: str, search_key: str = 'name', **params)` - Return Division Id(s) from name\n### [Leagues](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-League)\n* `Mlb.get_league(self, league_id: int, **params)` - Return a League from Id\n* `Mlb.get_leagues(self, **params)` - Return all Leagues\n* `Mlb.get_league_id(self, league_name: str, search_key: str = 'name', **params)` - Return League Id(s)\n### [Seasons](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Season)\n* `Mlb.get_season(self, season_id: str, sport_id: int = None, **params)` - Return a season\n* `Mlb.get_seasons(self, sportid: int = None, **params)` - Return all seasons\n### [Standings](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Standings)\n* `Mlb.get_standings(self, league_id: int, season: str, **params)` - Return standings\n### [Schedules](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Schedule)\n* `Mlb.get_schedule(self, date: str = None, start_date: str = None, end_date: str = None, sport_id: int = 1, team_id: int = None, **params)` - Return a Schedule from dates\n* `Mlb.get_scheduled_games_by_date(self, date: str = None,start_date: str = None, end_date: str = None, sport_id: int = 1, **params)` - Return game ids from dates\n### [Games](https://github.com/zero-sum-seattle/python-mlb-statsapi/wiki/Data-Types:-Game)\n* `Mlb.get_game(self, game_id: int, **params)` - Return the Game for a specific Game Id\n* `Mlb.get_game_play_by_play(self, game_id: int, **params)` - Return Play by play data for a game\n* `Mlb.get_game_line_score(self, game_id: int, **params)` - Return a Linescore for a game\n* `Mlb.get_game_box_score(self, game_id: int, **params)` - Return a Boxscore for a game\n\n\n## Contributing\n\nContributions are welcome! Whether it's bug fixes, new features, or documentation improvements, we appreciate your help.\n\n### Getting Started\n\n1. Fork the repository\n2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/python-mlb-statsapi.git`\n3. Install dependencies: `poetry install`\n4. Create a branch: `git checkout -b feat/your-feature`\n\n### Development\n\n```bash\n# Run tests\npoetry run pytest\n\n# Run external tests (requires internet)\npoetry run pytest tests/external_tests/\n```\n\n### Pull Request Guidelines\n\n- **All tests must pass** before submitting a PR\n- Use the [PR template](.github/pull_request_template.md) when creating your pull request\n- Follow the branch naming convention:\n  - `feat/` - New features\n  - `fix/` - Bug fixes\n  - `docs/` - Documentation updates\n  - `refactor/` - Code improvements\n\n### Reporting Issues\n\nFound a bug or have a feature request? Please [open an issue](https://github.com/zero-sum-seattle/python-mlb-statsapi/issues/new) with:\n\n- A clear description of the problem or feature\n- Steps to reproduce (for bugs)\n- Expected vs actual behavior\n- Python version and package version\n\n### Note on External Tests\n\nSome tests make real API calls to the MLB Stats API. These may occasionally fail due to:\n- API changes (new fields, removed endpoints)\n- Season/data availability\n\nIf you notice external test failures, please check if the MLB API has changed and update the models accordingly.\n\n\n## Examples\n\nLet's show some examples of getting stat objects from the API. What is baseball without stats, right?\n\n### Player Stats\nGet the Id(s) of the players you want stats for and set stat types and groups.\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e player_id = mlb.get_people_id(\"Ty France\")[0]\n\u003e\u003e\u003e stats = ['season', 'career']\n\u003e\u003e\u003e groups = ['hitting', 'pitching']\n\u003e\u003e\u003e params = {'season': 2022}\n```\n\nUse player id with stat types and groups to return a stats dictionary\n```python\n\u003e\u003e\u003e stat_dict = mlb.get_player_stats(player_id, stats=stats, groups=groups, **params)\n\u003e\u003e\u003e season_hitting_stat = stat_dict['hitting']['season']\n\u003e\u003e\u003e career_pitching_stat = stat_dict['pitching']['career']\n```\n\nPrint season hitting stats using Pydantic's `model_dump()`\n```python\n\u003e\u003e\u003e for split in season_hitting_stat.splits:\n...     print(split.stat.model_dump(exclude_none=True))\n{'games_played': 140, 'groundouts': 163, 'airouts': 148, 'runs': 65, 'doubles': 27, ...}\n```\n\nOr access individual fields directly\n```python\n\u003e\u003e\u003e for split in season_hitting_stat.splits:\n...     print(f\"Games: {split.stat.games_played}\")\n...     print(f\"Home Runs: {split.stat.home_runs}\")\n...     print(f\"Batting Avg: {split.stat.avg}\")\nGames: 140\nHome Runs: 20\nBatting Avg: .274\n```\n\n### Team Stats\nGet the Team Id(s)\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e team_id = mlb.get_team_id('Seattle Mariners')[0]\n```\n\nSet the stat types and groups\n```python\n\u003e\u003e\u003e stats = ['season', 'seasonAdvanced']\n\u003e\u003e\u003e groups = ['hitting']\n\u003e\u003e\u003e params = {'season': 2022}\n```\n\nUse team id and the stat types and groups to return season hitting stats\n```python\n\u003e\u003e\u003e stats = mlb.get_team_stats(team_id, stats=stats, groups=groups, **params)\n\u003e\u003e\u003e season_hitting = stats['hitting']['season']\n\u003e\u003e\u003e advanced_hitting = stats['hitting']['seasonAdvanced']\n```\n\nPrint stats as JSON\n```python\n\u003e\u003e\u003e for split in season_hitting.splits:\n...     print(split.stat.model_dump_json(indent=2, exclude_none=True))\n{\n  \"games_played\": 162,\n  \"groundouts\": 1273,\n  \"runs\": 690,\n  \"doubles\": 229,\n  ...\n}\n```\n\n### Expected Stats\n```python\n\u003e\u003e\u003e player_id = mlb.get_people_id('Ty France')[0]\n\u003e\u003e\u003e stats = ['expectedStatistics']\n\u003e\u003e\u003e group = ['hitting']\n\u003e\u003e\u003e params = {'season': 2022}\n\n\u003e\u003e\u003e stats = mlb.get_player_stats(player_id, stats=stats, groups=group, **params)\n\u003e\u003e\u003e expected = stats['hitting']['expectedStatistics']\n\u003e\u003e\u003e for split in expected.splits:\n...     print(f\"Expected AVG: {split.stat.avg}\")\n...     print(f\"Expected SLG: {split.stat.slg}\")\nExpected AVG: .259\nExpected SLG: .394\n```\n\n### vsPlayer Stats\nGet pitcher and batter player Ids\n```python\n\u003e\u003e\u003e ty_france_id = mlb.get_people_id('Ty France')[0]\n\u003e\u003e\u003e shohei_ohtani_id = mlb.get_people_id('Shohei Ohtani')[0]\n```\n\nSet stat type, stat groups, and params\n```python\n\u003e\u003e\u003e stats = ['vsPlayer']\n\u003e\u003e\u003e group = ['hitting']\n\u003e\u003e\u003e params = {'opposingPlayerId': shohei_ohtani_id, 'season': 2022}\n```\n\nGet stats\n```python\n\u003e\u003e\u003e stats = mlb.get_player_stats(ty_france_id, stats=stats, groups=group, **params)\n\u003e\u003e\u003e vs_player = stats['hitting']['vsPlayer']\n\u003e\u003e\u003e for split in vs_player.splits:\n...     print(f\"Games: {split.stat.games_played}, Hits: {split.stat.hits}\")\nGames: 2, Hits: 2\n```\n\n### Hot/Cold Zones\n```python\n\u003e\u003e\u003e ty_france_id = mlb.get_people_id('Ty France')[0]\n\u003e\u003e\u003e stats = ['hotColdZones']\n\u003e\u003e\u003e hitting_group = ['hitting']\n\u003e\u003e\u003e params = {'season': 2022}\n\n\u003e\u003e\u003e hotcoldzones = mlb.get_player_stats(ty_france_id, stats=stats, groups=hitting_group, **params)\n\u003e\u003e\u003e zones = hotcoldzones['stats']['hotColdZones']\n\n\u003e\u003e\u003e for split in zones.splits:\n...     print(f\"Stat: {split.stat.name}\")\n...     for zone in split.stat.zones:\n...         print(f\"  Zone {zone.zone}: {zone.value}\")\nStat: battingAverage\n  Zone 01: .226\n  Zone 02: .400\n  ...\n```\n\n### Schedule Examples\nGet a schedule for a given date\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e schedule = mlb.get_schedule(date='2022-10-13')\n\u003e\u003e\u003e dates = schedule.dates\n\n\u003e\u003e\u003e for date in dates:\n...     for game in date.games:\n...         print(f\"Game: {game.game_pk}\")\n...         print(f\"Status: {game.status.detailed_state}\")\n...         print(f\"Home: {game.teams.home.team.name}\")\n...         print(f\"Away: {game.teams.away.team.name}\")\n```\n\n### Game Examples\nGet a Game for a given game id\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e game = mlb.get_game(662242)\n```\n\nGet the weather for a game\n```python\n\u003e\u003e\u003e weather = game.game_data.weather\n\u003e\u003e\u003e print(f\"Condition: {weather.condition}\")\n\u003e\u003e\u003e print(f\"Temperature: {weather.temp}\")\n\u003e\u003e\u003e print(f\"Wind: {weather.wind}\")\n```\n\nGet the current status of a game\n```python\n\u003e\u003e\u003e linescore = game.live_data.linescore\n\u003e\u003e\u003e home_info = game.game_data.teams.home\n\u003e\u003e\u003e away_info = game.game_data.teams.away\n\u003e\u003e\u003e home_status = linescore.teams.home\n\u003e\u003e\u003e away_status = linescore.teams.away\n\n\u003e\u003e\u003e print(f\"Home: {home_info.franchise_name} {home_info.club_name}\")\n\u003e\u003e\u003e print(f\"  Runs: {home_status.runs}, Hits: {home_status.hits}, Errors: {home_status.errors}\")\n\u003e\u003e\u003e print(f\"Away: {away_info.franchise_name} {away_info.club_name}\")\n\u003e\u003e\u003e print(f\"  Runs: {away_status.runs}, Hits: {away_status.hits}, Errors: {away_status.errors}\")\n\u003e\u003e\u003e print(f\"Inning: {linescore.inning_half} {linescore.current_inning_ordinal}\")\n```\n\nGet play by play, line score, and box score objects\n```python\n\u003e\u003e\u003e play_by_play = game.live_data.plays\n\u003e\u003e\u003e line_score = game.live_data.linescore\n\u003e\u003e\u003e box_score = game.live_data.boxscore\n```\n\n#### Play by Play\nGet only the play by play for a given game id\n```python\n\u003e\u003e\u003e playbyplay = mlb.get_game_play_by_play(662242)\n```\n\n#### Line Score\nGet only the line score for a given game id\n```python\n\u003e\u003e\u003e linescore = mlb.get_game_line_score(662242)\n```\n\n#### Box Score\nGet only the box score for a given game id\n```python\n\u003e\u003e\u003e boxscore = mlb.get_game_box_score(662242)\n```\n\n### Gamepace Examples\nGet pace of game metrics for a specific season\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e gamepace = mlb.get_gamepace(season=2021)\n\u003e\u003e\u003e print(f\"Hits per game: {gamepace.sports[0].sport_game_pace.hits_per_game}\")\n```\n\n### People Examples\nGet all Players for a given sport id\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e players = mlb.get_people(sport_id=1)\n\u003e\u003e\u003e for player in players:\n...     print(f\"{player.id}: {player.full_name}\")\n```\n\nGet a player id\n```python\n\u003e\u003e\u003e player_id = mlb.get_people_id(\"Ty France\")\n\u003e\u003e\u003e print(player_id[0])\n664034\n```\n\n### Team Examples\nGet a Team\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e team_id = mlb.get_team_id(\"Seattle Mariners\")[0]\n\u003e\u003e\u003e team = mlb.get_team(team_id)\n\u003e\u003e\u003e print(f\"{team.id}: {team.name}\")\n\u003e\u003e\u003e print(f\"Venue: {team.venue.name}\")\n```\n\nGet a Player Roster\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e players = mlb.get_team_roster(136)\n\u003e\u003e\u003e for player in players:\n...     print(f\"#{player.jersey_number} {player.person.full_name}\")\n```\n\nGet a Coach Roster\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e coaches = mlb.get_team_coaches(136)\n\u003e\u003e\u003e for coach in coaches:\n...     print(f\"{coach.person.full_name}: {coach.title}\")\n```\n\n### Draft Examples\nGet a draft for a year\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e draft = mlb.get_draft('2019')\n```\n\nGet Players from Draft\n```python\n\u003e\u003e\u003e draftpicks = draft[0].picks\n\u003e\u003e\u003e for pick in draftpicks:\n...     print(f\"Round {pick.pick_round}, Pick {pick.pick_number}: {pick.person.full_name}\")\n```\n\n### Award Examples\nGet awards for a given award id\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e retired_numbers = mlb.get_awards(award_id='RETIREDUNI_108')\n\u003e\u003e\u003e for recipient in retired_numbers.awards:\n...     print(f\"{recipient.player.full_name}: {recipient.name} ({recipient.date})\")\n```\n\n### Venue Examples\nGet a Venue\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e venue_id = mlb.get_venue_id('PNC Park')[0]\n\u003e\u003e\u003e venue = mlb.get_venue(venue_id)\n\u003e\u003e\u003e print(f\"{venue.name} - {venue.location.city}, {venue.location.state}\")\n```\n\n### Division Examples\nGet a division\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e division = mlb.get_division(200)\n\u003e\u003e\u003e print(division.name)\nAmerican League West\n```\n\n### League Examples\nGet a league\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e league = mlb.get_league(103)\n\u003e\u003e\u003e print(league.name)\nAmerican League\n```\n\n### Season Examples\nGet a Season\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e season = mlb.get_season(2018)\n\u003e\u003e\u003e print(f\"Season: {season.season_id}\")\n\u003e\u003e\u003e print(f\"Regular Season: {season.regular_season_start_date} to {season.regular_season_end_date}\")\n```\n\n### Standings Examples\nGet Standings\n```python\n\u003e\u003e\u003e mlb = mlbstatsapi.Mlb()\n\u003e\u003e\u003e standings = mlb.get_standings(103, 2018)\n\u003e\u003e\u003e for record in standings:\n...     print(f\"Division: {record.division.name}\")\n...     for team in record.team_records:\n...         print(f\"  {team.team.name}: {team.wins}-{team.losses}\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-sum-seattle%2Fpython-mlb-statsapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzero-sum-seattle%2Fpython-mlb-statsapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-sum-seattle%2Fpython-mlb-statsapi/lists"}