Skip to content

Commit

Permalink
adding leaguedashteamstats endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
basketballrelativity committed Sep 28, 2022
1 parent c60971f commit a3d9e00
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions py_ball/league_dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class LeagueDash:
a given season by player.
*- **leaguedashplayerstats**: Traditional, plus/minus, and rank \
statistics for players.
*- **leaguedashteamstats**: Traditional, plus/minus, and rank \
statistics for teams.
- **leaguedashptdefend**: Defensive statistics for a given season \
by player.
- **leaguedashptteamdefend**: Defensive statistics for a given \
Expand Down Expand Up @@ -101,6 +103,13 @@ class LeagueDash:
- 'East', 'West', ''
@param **conference** (*str*): Conference in the API. String \
indicating the conference of the team for data to be \
returned. An empty string returns data across all conferences. \
Valid values include:
- 'East', 'West', ''
@param **last_n_games** (*str*): LastNGames in the API. String of \
an integer indicating the desired number of most recent games \
for data to be returned. A value of '0' returns data across \
Expand Down Expand Up @@ -233,6 +242,23 @@ class LeagueDash:
- 'Overall', '3 Pointers', '2 Pointers', 'Less Than 6Ft', \
'Less Than 10Ft', 'Greater Than 15Ft'
@param **po_round** (*str*): PORound in the API. 1, 2, 3, or 4 \
corresponding to the deired playoff round
@param **shot_clock_range** (*str*): ShotClockRange in the API \
Accepts one of the following strings for windows of the shot \
clock:
- "24-22"
- "22-18": very early
- "18-15": early
- "15-7": average
- "7-4": late
- "4-0": very late
@param **two_way** (*str*): TwoWay in the API. 1 to return stats \
for players on two-way contracts only. 0 to return all players
Attributes:
**api_resp** (*dict*): JSON object of the API response. The API \
Expand All @@ -252,7 +278,8 @@ def __init__(self, headers, endpoint='leaguedashlineups',
per_mode='PerGame', plus_minus='N',
rank='Y', pace_adjust='N',
measure_type='Base', period='0',
vs_conference='', last_n_games='0',
vs_conference='', conference='',
last_n_games='0',
team_id='0', location='', outcome='',
date_from='', date_to='', opp_team_id='0',
season='2017-18', vs_division='',
Expand All @@ -266,7 +293,9 @@ def __init__(self, headers, endpoint='leaguedashlineups',
distance_range='By Zone',
defense_category='Overall',
player_or_team="Player",
pt_measure_type='SpeedDistance'):
pt_measure_type='SpeedDistance',
po_round='', shot_clock_range='',
two_way='0'):

# Controlling the parameters depending on the endpoint
if endpoint not in ['leaguedashplayerbiostats',
Expand All @@ -282,6 +311,7 @@ def __init__(self, headers, endpoint='leaguedashlineups',
'MeasureType': measure_type,
'Period': period,
'VsConference': vs_conference,
'Conference': conference,
'Location': location,
'Outcome': outcome,
'DateFrom': date_from,
Expand All @@ -298,7 +328,10 @@ def __init__(self, headers, endpoint='leaguedashlineups',
'GameScope': game_scope,
'PlayerExperience': player_experience,
'PlayerPosition': player_position,
'StarterBench': starters_bench}
'StarterBench': starters_bench,
'PORound': po_round,
'ShotClockRange': shot_clock_range,
'TwoWay': two_way}
else:
params = {'LeagueID': league_id,
'PerMode': per_mode,
Expand Down

0 comments on commit a3d9e00

Please sign in to comment.