diff --git a/statsapi/__init__.py b/statsapi/__init__.py index 31a39ee..ed12de4 100644 --- a/statsapi/__init__.py +++ b/statsapi/__init__.py @@ -1246,11 +1246,16 @@ def lookup_player(lookup_value, gameType=None, season=None, sportId=1): r = get("sports_players", params) players = [] + lookup_values = str(lookup_value).lower().split() for player in r["people"]: - for v in player.values(): - if str(lookup_value).lower() in str(v).lower(): - players.append(player) + for l in lookup_values: + for v in player.values(): + if l in str(v).lower(): + break + else: break + else: + players.append(player) return players @@ -1635,7 +1640,7 @@ def notes(endpoint): return msg -def get(endpoint, params, force=False): +def get(endpoint, params={}, force=False): """Call MLB StatsAPI and return JSON data. This function is for advanced querying of the MLB StatsAPI, diff --git a/statsapi/endpoints.py b/statsapi/endpoints.py index a994ef7..672de20 100644 --- a/statsapi/endpoints.py +++ b/statsapi/endpoints.py @@ -81,7 +81,7 @@ "required": True, } }, - "query_params": ["divisionId", "leagueId", "sportId"], + "query_params": ["divisionId", "leagueId", "sportId", "season"], "required_params": [[]], "note": "Call divisions endpoint with no parameters to return a list of divisions.", }, @@ -782,6 +782,7 @@ "endDate", "opponentId", "fields", + "season", ], "required_params": [["sportId"], ["gamePk"], ["gamePks"]], }, @@ -1344,7 +1345,7 @@ "query_params": [[]], "required_params": [[]], "note": "The meta endpoint is used to retrieve values to be used within other API calls. Available types: awards, baseballStats, eventTypes, gameStatus, gameTypes, hitTrajectories, jobTypes, languages, leagueLeaderTypes, logicalEvents, metrics, pitchCodes, pitchTypes, platforms, positions, reviewReasons, rosterTypes, scheduleEventTypes, situationCodes, sky, standingsTypes, statGroups, statTypes, windDirection.", - } + }, # v1/analytics - requires authentication # v1/game/{gamePk}/guids - statcast data - requires authentication } diff --git a/statsapi/version.py b/statsapi/version.py index 4702d6a..5f4fc6a 100644 --- a/statsapi/version.py +++ b/statsapi/version.py @@ -1,3 +1,3 @@ #!/usr/bin/env python -VERSION = "1.7.2" +VERSION = "1.8"