Skip to content

Commit

Permalink
Merge pull request #147 from toddrob99/develop
Browse files Browse the repository at this point in the history
v1.8
  • Loading branch information
toddrob99 authored Oct 26, 2024
2 parents be8210d + 11e04aa commit 8fa2397
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
13 changes: 9 additions & 4 deletions statsapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions statsapi/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},
Expand Down Expand Up @@ -782,6 +782,7 @@
"endDate",
"opponentId",
"fields",
"season",
],
"required_params": [["sportId"], ["gamePk"], ["gamePks"]],
},
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion statsapi/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python

VERSION = "1.7.2"
VERSION = "1.8"

0 comments on commit 8fa2397

Please sign in to comment.