Skip to content

Commit

Permalink
Merge pull request #8 from toddrob99/develop
Browse files Browse the repository at this point in the history
## v0.0.8
* FIX: Error in schedule() when probable pitcher is missing #6 
* FIX: Error in schedule() when linescore is missing (postponed games) #7
  • Loading branch information
toddrob99 authored May 8, 2019
2 parents 5f3c029 + 11ccc09 commit 96fff84
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ print( statsapi.game_scoring_plays(567074) )

## Copyright Notice

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.
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.
5 changes: 3 additions & 2 deletions docs/endpoints.m.html
Original file line number Diff line number Diff line change
Expand Up @@ -2029,8 +2029,9 @@ <h1 class="title"><span class="name">statsapi.endpoints</span> module</h1>
<span class="s1">&#39;required&#39;</span><span class="p">:</span> <span class="bp">True</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="s1">&#39;query_params&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;season&#39;</span><span class="p">,</span><span class="s1">&#39;sportIds&#39;</span><span class="p">,</span><span class="s1">&#39;statGroup&#39;</span><span class="p">,</span><span class="s1">&#39;gameType&#39;</span><span class="p">,</span><span class="s1">&#39;stats&#39;</span><span class="p">,</span><span class="s1">&#39;order&#39;</span><span class="p">,</span><span class="s1">&#39;sortStat&#39;</span><span class="p">,</span><span class="s1">&#39;fields&#39;</span><span class="p">],</span>
<span class="s1">&#39;required_params&#39;</span><span class="p">:</span> <span class="p">[[</span><span class="s1">&#39;season&#39;</span><span class="p">,</span><span class="s1">&#39;statGroup&#39;</span><span class="p">]]</span>
<span class="s1">&#39;query_params&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;season&#39;</span><span class="p">,</span><span class="s1">&#39;sportIds&#39;</span><span class="p">,</span><span class="s1">&#39;group&#39;</span><span class="p">,</span><span class="s1">&#39;gameType&#39;</span><span class="p">,</span><span class="s1">&#39;stats&#39;</span><span class="p">,</span><span class="s1">&#39;order&#39;</span><span class="p">,</span><span class="s1">&#39;sortStat&#39;</span><span class="p">,</span><span class="s1">&#39;fields&#39;</span><span class="p">],</span>
<span class="s1">&#39;required_params&#39;</span><span class="p">:</span> <span class="p">[[</span><span class="s1">&#39;season&#39;</span><span class="p">,</span><span class="s1">&#39;group&#39;</span><span class="p">,</span><span class="s1">&#39;stats&#39;</span><span class="p">]],</span>
<span class="s1">&#39;note&#39;</span><span class="p">:</span> <span class="s1">&#39;Use meta(</span><span class="se">\&#39;</span><span class="s1">statGroups</span><span class="se">\&#39;</span><span class="s1">) to look up valid values for group, and meta(</span><span class="se">\&#39;</span><span class="s1">statTypes</span><span class="se">\&#39;</span><span class="s1">) for valid values for stats.&#39;</span>
<span class="p">},</span>
<span class="s1">&#39;teams_affiliates&#39;</span><span class="p">:</span> <span class="p">{</span>
<span class="s1">&#39;url&#39;</span><span class="p">:</span> <span class="n">BASE_URL</span> <span class="o">+</span> <span class="s1">&#39;{ver}/teams/affiliates&#39;</span><span class="p">,</span>
Expand Down
16 changes: 8 additions & 8 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1252,12 +1252,12 @@ <h1>MLB-StatsAPI</h1>
<span class="s1">&#39;game_num&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;gameNumber&#39;</span><span class="p">],</span>
<span class="s1">&#39;home_probable_pitcher&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fullName&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_probable_pitcher&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fullName&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;home_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;home_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_score&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;score&#39;</span><span class="p">,</span><span class="s1">&#39;0&#39;</span><span class="p">),</span>
<span class="s1">&#39;home_score&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;score&#39;</span><span class="p">,</span><span class="s1">&#39;0&#39;</span><span class="p">),</span>
<span class="s1">&#39;current_inning&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;linescore&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;currentInning&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;inning_state&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;linescore&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;inningState&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">)</span>
<span class="s1">&#39;current_inning&#39;</span><span class="p">:</span> <span class="n">game</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;linescore&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;currentInning&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;inning_state&#39;</span><span class="p">:</span> <span class="n">game</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;linescore&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;inningState&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">)</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">game_info</span><span class="p">[</span><span class="s1">&#39;status&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;Final&#39;</span><span class="p">,</span><span class="s1">&#39;Game Over&#39;</span><span class="p">]:</span>
<span class="k">if</span> <span class="n">game</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;isTie&#39;</span><span class="p">):</span>
Expand Down Expand Up @@ -4496,12 +4496,12 @@ <h1>56 P Zach Eflin</h1></div>
<span class="s1">&#39;game_num&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;gameNumber&#39;</span><span class="p">],</span>
<span class="s1">&#39;home_probable_pitcher&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fullName&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_probable_pitcher&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fullName&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;home_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;home_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_pitcher_note&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;probablePitcher&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;note&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;away_score&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;away&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;score&#39;</span><span class="p">,</span><span class="s1">&#39;0&#39;</span><span class="p">),</span>
<span class="s1">&#39;home_score&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;teams&#39;</span><span class="p">][</span><span class="s1">&#39;home&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;score&#39;</span><span class="p">,</span><span class="s1">&#39;0&#39;</span><span class="p">),</span>
<span class="s1">&#39;current_inning&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;linescore&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;currentInning&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;inning_state&#39;</span><span class="p">:</span> <span class="n">game</span><span class="p">[</span><span class="s1">&#39;linescore&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;inningState&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">)</span>
<span class="s1">&#39;current_inning&#39;</span><span class="p">:</span> <span class="n">game</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;linescore&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;currentInning&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">),</span>
<span class="s1">&#39;inning_state&#39;</span><span class="p">:</span> <span class="n">game</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;linescore&#39;</span><span class="p">,{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;inningState&#39;</span><span class="p">,</span><span class="s1">&#39;&#39;</span><span class="p">)</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">game_info</span><span class="p">[</span><span class="s1">&#39;status&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;Final&#39;</span><span class="p">,</span><span class="s1">&#39;Game Over&#39;</span><span class="p">]:</span>
<span class="k">if</span> <span class="n">game</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;isTie&#39;</span><span class="p">):</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/version.m.html
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ <h1 class="title"><span class="name">statsapi.version</span> module</h1>
<div id="source-statsapi.version" class="source">
<div class="codehilite"><pre><span></span><span class="ch">#!/usr/bin/env python</span>

<span class="n">VERSION</span> <span class="o">=</span> <span class="s1">&#39;0.0.7&#39;</span>
<span class="n">VERSION</span> <span class="o">=</span> <span class="s1">&#39;0.0.8&#39;</span>
</pre></div>

</div>
Expand Down
Loading

0 comments on commit 96fff84

Please sign in to comment.