toddrob99 / MLB-StatsAPI

Python wrapper for MLB Stats API
GNU General Public License v3.0
533 stars 100 forks source link

Is there a function for current game? #72

Closed jcsacto closed 2 years ago

jcsacto commented 2 years ago

First off, thank you for this app, it's exactly what I was looking for to display my SF Giants stats on my TV dashboard. I thought I could use the next_game function to show scores as the game is played (since it has a spot for home/away scores). But that doesn't appear to be the case. Is there an easy way to get the current game ID to pass to the one of the other game stats functions? Thanks again!

toddrob99 commented 2 years ago

You can get today's gamePk(s) from the schedule endpoint using the get method or the schedule method. Either way, pass your team id and date, and grab the gamePk/game_id from the result. The schedule method might even return all the info you want.

jcsacto commented 2 years ago

Ok, that works easy enough, I should have tried that prior to asking. :) Thanks again!