Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Positional Argument for ScheduleGames.__init__ #210

Closed
pferreira8 opened this issue May 26, 2024 · 4 comments
Closed

Missing Positional Argument for ScheduleGames.__init__ #210

pferreira8 opened this issue May 26, 2024 · 4 comments

Comments

@pferreira8
Copy link

I have some code that was working last I checked a few months ago and no longer the case.

    def get_season_games(self, _season :mlb.models.seasons.Season):
        st, end = _season.seasonstartdate, _season.seasonenddate # extract start and end dates from season object
        # print(st, end)
        # return self.api.get_game_ids(sport_id=1, start_date=st, end_date=datetime.date.today().isoformat())
        return self.api.get_scheduled_games_by_date(start_date=st, end_date=end)

self.api is set = mlb.Mlb()

TypeError: ScheduleGames.init() missing 1 required positional argument: 'ifnecessarydescription'

@mlwilliams217
Copy link

Ran into the same problem. Just to help debug, I'm narrowed down the exact date where the error occurs, which is 2024-05-14. This works

  # Initialize API object
  mlb = mlbstatsapi.Mlb()

  # Get games
  all_games = mlb.get_scheduled_games_by_date(
      start_date="2024-05-01", end_date=""2024-05-13", gameTypes="R"
  )

And this also works

  # Initialize API object
  mlb = mlbstatsapi.Mlb()

  # Get games
  all_games = mlb.get_scheduled_games_by_date(
      start_date="2024-05-15", end_date=""2024-05-24", gameTypes="R"
  )

However passing a date range that includes "2024-05-14" in it will result in the error referred to above. I assume it's from some sort of weird data for a game that day (I see there's a postponed game then).

@KCNilssen
Copy link
Collaborator

Looks like the MLB API was updated recently. Thats why it's only throwing that "missing required positional argument' TypeError after a certain date!

I'll get on fixing that as soon as I can. Thanks for the heads up guys!

@KCNilssen
Copy link
Collaborator

pferreira8 and mlwilliams217, Apologies for the delay, some things came up IRL but everything should be working and published. Update and give it a go

@pferreira8
Copy link
Author

pferreira8 and mlwilliams217, Apologies for the delay, some things came up IRL but everything should be working and published. Update and give it a go

great to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants