Skip to content

Commit 8fa2397

Browse files
authored
Merge pull request #147 from toddrob99/develop
v1.8
2 parents be8210d + 11e04aa commit 8fa2397

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

statsapi/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,11 +1246,16 @@ def lookup_player(lookup_value, gameType=None, season=None, sportId=1):
12461246
r = get("sports_players", params)
12471247

12481248
players = []
1249+
lookup_values = str(lookup_value).lower().split()
12491250
for player in r["people"]:
1250-
for v in player.values():
1251-
if str(lookup_value).lower() in str(v).lower():
1252-
players.append(player)
1251+
for l in lookup_values:
1252+
for v in player.values():
1253+
if l in str(v).lower():
1254+
break
1255+
else:
12531256
break
1257+
else:
1258+
players.append(player)
12541259

12551260
return players
12561261

@@ -1635,7 +1640,7 @@ def notes(endpoint):
16351640
return msg
16361641

16371642

1638-
def get(endpoint, params, force=False):
1643+
def get(endpoint, params={}, force=False):
16391644
"""Call MLB StatsAPI and return JSON data.
16401645
16411646
This function is for advanced querying of the MLB StatsAPI,

statsapi/endpoints.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"required": True,
8282
}
8383
},
84-
"query_params": ["divisionId", "leagueId", "sportId"],
84+
"query_params": ["divisionId", "leagueId", "sportId", "season"],
8585
"required_params": [[]],
8686
"note": "Call divisions endpoint with no parameters to return a list of divisions.",
8787
},
@@ -782,6 +782,7 @@
782782
"endDate",
783783
"opponentId",
784784
"fields",
785+
"season",
785786
],
786787
"required_params": [["sportId"], ["gamePk"], ["gamePks"]],
787788
},
@@ -1344,7 +1345,7 @@
13441345
"query_params": [[]],
13451346
"required_params": [[]],
13461347
"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.",
1347-
}
1348+
},
13481349
# v1/analytics - requires authentication
13491350
# v1/game/{gamePk}/guids - statcast data - requires authentication
13501351
}

statsapi/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env python
22

3-
VERSION = "1.7.2"
3+
VERSION = "1.8"

0 commit comments

Comments
 (0)