diff --git a/pybaseball/team_batting.py b/pybaseball/team_batting.py index 8d8504dd..1ada4121 100644 --- a/pybaseball/team_batting.py +++ b/pybaseball/team_batting.py @@ -25,12 +25,16 @@ def team_batting_bref(team: str, start_season: int, end_season: Optional[int]=No """ if start_season is None: raise ValueError( - "You need to provide at least one season to collect data for. Try team_batting_bref(season) or team_batting_bref(start_season, end_season)." + "You need to provide at least one season to collect data for. Try team_batting_bref(team, season) or team_batting_bref(team, start_season, end_season)." ) if end_season is None: end_season = start_season + if end_season < start_season: + raise ValueError( + "The end_season cannot be before the start_season." + ) - url = "https://www.baseball-reference.com/teams/{}".format(team) + url = "https://www.baseball-reference.com/teams/{}".format(team.upper()) raw_data = [] headings: Optional[List[str]] = None diff --git a/pybaseball/team_fielding.py b/pybaseball/team_fielding.py index 7546e5e2..b26897aa 100644 --- a/pybaseball/team_fielding.py +++ b/pybaseball/team_fielding.py @@ -28,12 +28,16 @@ def team_fielding_bref(team: str, start_season: int, end_season: Optional[int]=N if start_season is None: raise ValueError( "You need to provide at least one season to collect data for. " + - "Try team_fielding_bref(season) or team_fielding_bref(start_season, end_season)." + "Try team_fielding_bref(team, season) or team_fielding_bref(team, start_season, end_season)." ) if end_season is None: end_season = start_season + if end_season < start_season: + raise ValueError( + "The end_season cannot be before the start_season." + ) - url = "https://www.baseball-reference.com/teams/{}".format(team) + url = "https://www.baseball-reference.com/teams/{}".format(team.upper()) raw_data = [] headings: Optional[List[str]] = None diff --git a/pybaseball/team_pitching.py b/pybaseball/team_pitching.py index 38ef58c8..acfd68d4 100644 --- a/pybaseball/team_pitching.py +++ b/pybaseball/team_pitching.py @@ -25,12 +25,16 @@ def team_pitching_bref(team: str, start_season: int, end_season: Optional[int]=N """ if start_season is None: raise ValueError( - "You need to provide at least one season to collect data for. Try team_pitching_bref(season) or team_pitching_bref(start_season, end_season)." + "You need to provide at least one season to collect data for. Try team_pitching_bref(team, season) or team_pitching_bref(team, start_season, end_season)." ) if end_season is None: end_season = start_season + if end_season < start_season: + raise ValueError( + "The end_season cannot be before the start_season." + ) - url = "https://www.baseball-reference.com/teams/{}".format(team) + url = "https://www.baseball-reference.com/teams/{}".format(team.upper()) raw_data = [] headings: Optional[List[str]] = None