Skip to content

Commit 72fa37f

Browse files
committed
fix: box data error if pitcher has 0 pitches #66
ver: 1.4.1
1 parent f6c1cf2 commit 72fa37f

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

statsapi/__init__.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,9 @@ def boxscore_data(gamePk, timecode=None):
746746
]
747747
),
748748
"p": str(
749-
boxData[side]["players"]["ID" + pitcherId]["stats"]["pitching"][
750-
"pitchesThrown"
751-
]
749+
boxData[side]["players"]["ID" + pitcherId]["stats"]["pitching"].get(
750+
"pitchesThrown", 0
751+
)
752752
),
753753
"s": str(
754754
boxData[side]["players"]["ID" + pitcherId]["stats"]["pitching"][
@@ -866,8 +866,7 @@ def linescore(gamePk, timecode=None):
866866

867867

868868
def last_game(teamId):
869-
"""Get the gamePk for the given team's most recent completed game.
870-
"""
869+
"""Get the gamePk for the given team's most recent completed game."""
871870
previousSchedule = get(
872871
"team",
873872
{
@@ -887,8 +886,7 @@ def last_game(teamId):
887886

888887

889888
def next_game(teamId):
890-
"""Get the gamePk for the given team's next unstarted game.
891-
"""
889+
"""Get the gamePk for the given team's next unstarted game."""
892890
nextSchedule = get(
893891
"team",
894892
{
@@ -1338,8 +1336,20 @@ def standings(
13381336
for div in divisions.values():
13391337
standings += div["div_name"] + "\n"
13401338
if include_wildcard:
1341-
standings += "{:^4} {:<21} {:^3} {:^3} {:^4} {:^4} {:^7} {:^5} {:^4}\n".format(
1342-
*["Rank", "Team", "W", "L", "GB", "(E#)", "WC Rank", "WC GB", "(E#)"]
1339+
standings += (
1340+
"{:^4} {:<21} {:^3} {:^3} {:^4} {:^4} {:^7} {:^5} {:^4}\n".format(
1341+
*[
1342+
"Rank",
1343+
"Team",
1344+
"W",
1345+
"L",
1346+
"GB",
1347+
"(E#)",
1348+
"WC Rank",
1349+
"WC GB",
1350+
"(E#)",
1351+
]
1352+
)
13431353
)
13441354
for t in div["teams"]:
13451355
standings += "{div_rank:^4} {name:<21} {w:^3} {l:^3} {gb:^4} {elim_num:^4} {wc_rank:^7} {wc_gb:^5} {wc_elim_num:^4}\n".format(

statsapi/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env python
22

3-
VERSION = "1.4"
3+
VERSION = "1.4.1"

0 commit comments

Comments
 (0)