Closed ewrwrnjwqr closed 2 years ago
The schedule method defaults sportId
to 1
for MLB. If you want games for a different league, you have to include the sportId
parameter. Try statsapi.schedule(date='2019-07-09', sportId=586)
. List of sports available here. I got 586
from the team info for one of the teams listed in the gamePk you specified.
There appears to be no data on 2022 using sportID = 586. They might've stopped posting it. Any other ideas on how I could make sure?
I agree, there's nothing available for that sportId in 2022 (https://statsapi.mlb.com/api/v1/schedule?sportId=586&startDate=2022-01-01&endDate=2022-12-31). It may be posted under a different sportId for some reason. If you can view the data on an MLB website, you may be able to use your browser's developer tools to find some API calls with a gamePk or sportId you can use.
I can search for this specific game_id using the line of code below, but then cannot do the opposite and search by team = "American". Is there a way to get a full list of games from a day including ones hidden by the API like the game_id below. Alternatively, is there a way to return all game_id at are public-facing?
statsapi.schedule(game_id=658972)