本文整理汇总了Python中nba.utils.get_response函数的典型用法代码示例。如果您正苦于以下问题:Python get_response函数的具体用法?Python get_response怎么用?Python get_response使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_response函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: play_by_play
def play_by_play(game_id):
"""
return play by play data for a given game
args:
game_id (int)
returns:
plays (list)
each player is a dict with the following available keys
["GAME_ID","EVENTNUM","EVENTMSGTYPE","EVENTMSGACTIONTYPE","PERIOD",
"WCTIMESTRING","PCTIMESTRING","HOMEDESCRIPTION","NEUTRALDESCRIPTION",
"VISITORDESCRIPTION","SCORE","SCOREMARGIN","PERSON1TYPE","PLAYER1_ID",
"PLAYER1_NAME","PLAYER1_TEAM_ID","PLAYER1_TEAM_CITY",
"PLAYER1_TEAM_NICKNAME","PLAYER1_TEAM_ABBREVIATION","PERSON2TYPE",
"PLAYER2_ID","PLAYER2_NAME","PLAYER2_TEAM_ID","PLAYER2_TEAM_CITY",
"PLAYER2_TEAM_NICKNAME","PLAYER2_TEAM_ABBREVIATION","PERSON3TYPE",
"PLAYER3_ID","PLAYER3_NAME","PLAYER3_TEAM_ID","PLAYER3_TEAM_CITY",
"PLAYER3_TEAM_NICKNAME","PLAYER3_TEAM_ABBREVIATION"]
"""
endpoint = 'http://stats.nba.com/stats/playbyplayv2'
payload = {
'GameID': game_id,
'StartPeriod': 1,
'EndPeriod': 10,
'StartRange': 0,
'EndRange': 28800,
'RangeType': 0
}
response = utils.get_response(endpoint, payload)
return response['PlayerStats']
示例2: all_players
def all_players(season, all_time=False):
"""
return all players
args:
season: format ex: '1999-00', also accepts 1999 or 99
returns:
players (list)
each player is a dict with the following available keys
["PERSON_ID","DISPLAY_LAST_COMMA_FIRST","ROSTERSTATUS","FROM_YEAR",
"TO_YEAR","PLAYERCODE"]
"""
# IsOnlyCurrentSeason: 0 is false 1 is true
cur_season = 1
if all_time:
cur_season = 0
endpoint = 'http://stats.nba.com/stats/commonallplayers'
payload = {
"LeagueID": "00",
"Season": utils.cleanse_season(season),
"IsOnlyCurrentSeason": cur_season
}
response = utils.get_response(endpoint, payload)
return response['CommonAllPlayers']
示例3: standings_from_date
def standings_from_date(date):
"""
return the standing on a given date
args:
date (string): format=mm/dd/yyyy
returns:
standings (dict) keys are 'EAST', and 'WEST'
values are teams
teams (list): games that happen that day
each team is a dict with the following available keys
["TEAM_ID","LEAGUE_ID","SEASON_ID","STANDINGSDATE","CONFERENCE","TEAM",
"G","W","L","W_PCT","HOME_RECORD","ROAD_RECORD"]
"""
endpoint = 'http://stats.nba.com/stats/scoreboardv2'
payload = {
'DayOffset': '0',
'LeagueID': '00',
'gameDate': date
}
response = utils.get_response(endpoint, payload)
return {
'EAST': response['EastConfStandingsByDay'],
'WEST': response['WestConfStandingsByDay']
}
示例4: team_game_log
def team_game_log(team_id, season):
"""
return games that a team has already played in given season
args:
team_id (int)
season: format ex: '1999-00', also accepts 1999 or 99
returns:
games (list): games a team has played in given season
each game is a dict with the following available keys
["TEAM_ID","GAME_ID","GAME_DATE","MATCHUP","WL","MIN",
"FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM",
"FTA","FT_PCT","OREB","DREB","REB","AST","STL","BLK",
"TOV","PF","PTS"]
"""
endpoint = 'http://stats.nba.com/stats/teamgamelog'
payload = {
"TeamID": team_id,
"LeagueID": "00",
"Season": utils.cleanse_season(season),
"SeasonType": "Regular Season"
}
response = utils.get_response(endpoint, payload)
return response['TeamGameLog']
示例5: player_game_log
def player_game_log(player_id, season):
"""
return games that a player has already played in given season
args:
player_id (int)
season: format ex: '1999-00', also accepts 1999 or 99
returns:
games (list): games a player has played in given season
each game is a dict with the following available keys
["SEASON_ID","PLAYER_ID","GAME_ID","GAME_DATE","MATCHUP","WL","MIN",
"FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM","FTA","FT_PCT",
"OREB","DREB","REB","AST","STL","BLK","TOV","PF","PTS","PLUS_MINUS",
"VIDEO_AVAILABLE"]
"""
endpoint = 'http://stats.nba.com/stats/playergamelog'
payload = {
"PlayerID": player_id,
"LeagueID": "00",
"Season": utils.cleanse_season(season),
"SeasonType": "Regular Season"
}
response = utils.get_response(endpoint, payload)
return response['PlayerGameLog']
示例6: player_game_shot_chart
def player_game_shot_chart(game_id, team_id, player_id):
# TODO check to make sure correct
"""
return player tracking information for a given game
args:
game_id (int)
#TODO get team_id from player_id
team_id (int)
player_id (int)
returns:
shots (list): shots a player attempted during a game
each player is a dict with the following available keys
["GRID_TYPE","GAME_ID","GAME_EVENT_ID","PLAYER_ID","PLAYER_NAME","TEAM_ID",
"TEAM_NAME","PERIOD","MINUTES_REMAINING","SECONDS_REMAINING","EVENT_TYPE",
"ACTION_TYPE","SHOT_TYPE","SHOT_ZONE_BASIC","SHOT_ZONE_AREA",
"SHOT_ZONE_RANGE","SHOT_DISTANCE","LOC_X","LOC_Y","SHOT_ATTEMPTED_FLAG",
"SHOT_MADE_FLAG"]
"""
endpoint = 'http://stats.nba.com/stats/shotchartdetail'
payload = {
"LeagueID": "00",
#see if need season or can get from game_id
"Season": "2014-15",
"SeasonType": "Regular Season",
"TeamID": team_id,
"PlayerID": player_id,
"GameID": game_id,
"Outcome": None,
"Location": None,
"Month": 0,
"SeasonSegment": None,
"DateFrom": None,
"DateTo": None,
"OpponentTeamID": 0,
"VsConference": None,
"VsDivision": None,
"Position": None,
"RookieYear": None,
"GameSegment": None,
"Period": 0,
"LastNGames": 0,
"ClutchTime": None,
"AheadBehind": None,
"PointDiff": None,
"RangeType": 2,
"StartPeriod": 1,
"EndPeriod": 10,
"StartRange": 0,
"EndRange": 28800,
"ContextFilter": "",
"ContextMeasure": "FGA"
}
response = utils.get_response(endpoint, payload)
return response['Shot_Chart_Detail']
示例7: league_leaders
def league_leaders(season):
# TODO document
endpoint = 'http://stats.nba.com/stats/leagueleaders'
payload = {
"LeagueID": "00",
"PerMode": "PerGame",
"StatCategory": "PTS",
"Season": util.cleanse_season(season),
"SeasonType": "Regular Season",
"Scope": "S"
}
response = utils.get_response(endpoint, payload)
return response['LeagueLeaders']
示例8: team_screen_def
def team_screen_def():
"""
returns synergy screen data for all teams this season
returns:
teams (list): offensive stats for off screen plays for all teams
each team is a dict with the following available keys
["TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
"Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
"FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]
"""
endpoint = 'http://stats.nba.com/js/data/playtype/team_OffScreen.js'
response = utils.get_response(endpoint, None)
return response['Defensive']
示例9: player_pnr_handler_off
def player_pnr_handler_off():
"""
returns synergy PnR ball handler data for all players this season
returns:
players (list): data for all players
each player is a dict with the following available keys
["PlayerIDSID","PlayerFirstName","PlayerLastName","PlayerNumber","P",
"TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
"Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
"FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]
"""
endpoint = 'http://stats.nba.com/js/data/playtype/player_PRBallHandler.js'
response = utils.get_response(endpoint, None)
return response['Offensive']
示例10: team_drive
def team_drive(season):
"""
returns sportsvu driving data for all teams
args:
season
returns:
teams (list): driving data for all teams
each team is a dict with the following available keys
["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
"MIN","DVS","DPP","DTP","FG_PCT","PTS_48","DPP_TOT","DVS_TOT"]
"""
endpoint = 'http://stats.nba.com/js/data/sportvu/%s/drivesTeamData.json' % util.season_to_int(season)
response = utils.get_response(endpoint, None)
return response['TeamTrackingDrivesStats']
示例11: player_drive
def player_drive(season):
"""
returns sportsvu driving data for all players
args:
season
returns:
players (list): driving data for all players
each player is a dict with the following available keys
["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
"MIN","DVS","DPP","DTP","FG_PCT","PTS_48","DPP_TOT","DVS_TOT"]
"""
endpoint = 'http://stats.nba.com/js/data/sportvu/%s/drivesData.json' % util.season_to_int(season)
response = utils.get_response(endpoint, None)
return response['PlayerTrackingDrivesStats']
示例12: team_touches
def team_touches(season):
"""
returns sportsvu touches data for all teams
args:
season
returns:
teams (list): touches data for all teams
each team is a dict with the following available keys
["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
"MIN","TCH","FC_TCH","TOP","CL_TCH","EL_TCH","PTS","PTS_TCH","PTS_HCCT",
"TCH_TOT"]
"""
endpoint = 'http://stats.nba.com/js/data/sportvu/%s/touchesTeamData.json' % util.season_to_int(season)
response = utils.get_response(endpoint, None)
return response['TeamTrackingTouchesStats']
示例13: team_passing
def team_passing(season):
"""
returns sportsvu passing data for all teams
args:
season
returns:
teams (list): passing data for all teams
each team is a dict with the following available keys
["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
"MIN","PASS","AST","AST_FT","AST_SEC","AST_POT","PTS_CRT","PTS_CRT_48",
"AST_TOT"]
"""
endpoint = 'http://stats.nba.com/js/data/sportvu/%s/passingTeamData.json' % util.season_to_int(season)
response = utils.get_response(endpoint, None)
return response['TeamTrackingPassingStats']
示例14: team_speed
def team_speed(season):
"""
returns sportsvu speed data for all teams
args:
season
returns:
teams (list): speed data for all teams
each team is a dict with the following available keys
["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
"MIN","DIST","AV_SPD","DIST_PG","DIST_48","DIST_OFF","DIST_DEF",
"AV_SPD_OFF","AV_SPD_DEF"]
"""
endpoint = 'http://stats.nba.com/js/data/sportvu/%s/speedTeamData.json' % util.season_to_int(season)
response = utils.get_response(endpoint, None)
return response['TeamTrackingSpeedStats']
示例15: team_catch_shoot
def team_catch_shoot(season):
"""
returns sportsvu catch and shoot data for all teams
args:
season
returns:
teams (list): catch and shoot data for all teams
each team is a dict with the following available keys
["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
"MIN","PTS","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","EFG_PCT",
"PTS_TOT"]
"""
endpoint = 'http://stats.nba.com/js/data/sportvu/%s/catchShootTeamData.json' % util.season_to_int(season)
response = utils.get_response(endpoint, None)
return response['TeamTrackingCatchShootStats']