-
Hey! I'm using this library as input to a chatbot I built to run a team in a league this year. Search/LLM is still fantastically bad at some fact finding, like, "when is Digg's next game?" After rooting around in the API for a while I landed on a path but it is hacky. Where I ended up is getting the roster off the box: BoxScore = [x for x in self.league.box_scores() if x.home_team.team_id == 7 or x.away_team.team_id == 7][0]
self.boxRoster = box.away_lineup if box.away_team.team_id == 7 else box.home_lineup And then when I construct the dictionary to serialize back to my other thing, I add it: "next_game_time": next((x.game_date.strftime('%m/%d/%Y %H:%M') for x in self.boxRoster if x.playerId == player.playerId), 'Unknown') (I am not a python dev so if this is a nonsense way to do this I'm sorry :)) I haven't spent a ton of time looking at the data model here to understand if there is an easier way to link a the (Incidentally, @cwendt94, what's your opinion on adding more typing / exposing things? Just to make my life easier I hacked exporting |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
At the moment that might be the easiest way. You can get the full schedule by pro team using We have added schedule to the player class in basketball league and should be able to do the same for football. I can look at adding that feature. For the typing and exposing things that would be great! I haven't had a lot of time to do more maintenance and clean up lately. |
Beta Was this translation helpful? Give feedback.
-
Players schedule has been added in v0.39.0! Here is an example, schedule is broken down by scoring period (week) and contains team and date. >>> league.teams[0].roster[0]
Player(Jonathan Taylor)
>>> league.teams[0].roster[0].schedule
{'1': {'team': 'HOU', 'date': datetime.datetime(2024, 9, 8, 17, 0)}, '2': {'team': 'GB', 'date': datetime.datetime(2024, 9, 15, 17, 0)},
'3': {'team': 'CHI', 'date': datetime.datetime(2024, 9, 22, 17, 0)}, '4': {'team': 'PIT', 'date': datetime.datetime(2024, 9, 29, 17, 0)},
'5': {'team': 'JAX', 'date': datetime.datetime(2024, 10, 6, 17, 0)}, '6': {'team': 'TEN', 'date': datetime.datetime(2024, 10, 13, 17, 0)},
'7': {'team': 'MIA', 'date': datetime.datetime(2024, 10, 20, 17, 0)}, '8': {'team': 'HOU', 'date': datetime.datetime(2024, 10, 27, 17, 0)},
'9': {'team': 'MIN', 'date': datetime.datetime(2024, 11, 3, 18, 0)}, '10': {'team': 'BUF', 'date': datetime.datetime(2024, 11, 10, 18, 0)},
'11': {'team': 'NYJ', 'date': datetime.datetime(2024, 11, 18, 1, 20)}, '12': {'team': 'DET', 'date': datetime.datetime(2024, 11, 24, 18, 0)},
'13': {'team': 'NE', 'date': datetime.datetime(2024, 12, 1, 18, 0)}, '15': {'team': 'DEN', 'date': datetime.datetime(2024, 12, 15, 21, 25)},
'16': {'team': 'TEN', 'date': datetime.datetime(2024, 12, 22, 18, 0)}, '17': {'team': 'NYG', 'date': datetime.datetime(2024, 12, 29, 8, 1)},
'18': {'team': 'JAX', 'date': datetime.datetime(2025, 1, 5, 8, 1)}} |
Beta Was this translation helpful? Give feedback.
-
This is great! Thank you! |
Beta Was this translation helpful? Give feedback.
Players schedule has been added in v0.39.0! Here is an example, schedule is broken down by scoring period (week) and contains team and date.