示例#1
0
 def __init__(
     self,
     league="NBA",
     permode="PerGame",
     scope="S",
     season="2014",
     seasontype="Regular Season",
     statcategory="PTS",
     AllTime=False,
 ):
     self._url = "http://stats.nba.com/stats/leagueleaders?"
     if not AllTime:
         self._api_param = {
             "LeagueID": _nbaLeague(league),
             "Scope": scope,
             "PerMode": permode,
             "Season": _nbaSeason(season),
             "SeasonType": seasontype,
             "StatCategory": statcategory,
         }
     else:
         self._api_param = {
             "LeagueID": _nbaLeague(league),
             "Scope": scope,
             "PerMode": permode,
             "Season": "All Time",
             "SeasonType": seasontype,
             "StatCategory": statcategory,
         }
     # Scope: (RS)|(S)|(Rookies) one of these options
     self._pull = _requests.get(self._url, params=self._api_param)
示例#2
0
def PlayerList(season="2014", AllTime=False, league="NBA"):
    if AllTime:
        _url = "http://stats.nba.com/stats/commonallplayers?"
        _api_param = {"IsOnlyCurrentSeason": "0", "LeagueID": _nbaLeague(league), "Season": "2014-15"}
        _pull = _requests.get(_url, params=_api_param)
        _headers = _pull.json()["resultSets"][0]["headers"]
        _values = _pull.json()["resultSets"][0]["rowSet"]
        return [dict(zip(_headers, value)) for value in _values]
    else:
        _url = "http://stats.nba.com/stats/commonallplayers?"
        _api_param = {"IsOnlyCurrentSeason": "1", "LeagueID": _nbaLeague(league), "Season": _nbaSeason(season)}
        _pull = _requests.get(_url, params=_api_param)
        _headers = _pull.json()["resultSets"][0]["headers"]
        _values = _pull.json()["resultSets"][0]["rowSet"]
        return [dict(zip(_headers, value)) for value in _values]
示例#3
0
 def __init__(self, teamid, season='2014',league='NBA'):
     self._url = "http://stats.nba.com/stats/commonteamroster?"
     self._api_param = {'TeamID':teamid,
                         'Season': _nbaSeason(season),
                         'LeagueID': _nbaLeague(league)
                         }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#4
0
 def __init__(self, teamid, season='2014',league='NBA', datefrom='',
     dateto='', gamesegment=1, lastngames='0', location=1, measuretype=1,
     month='0', opponentteamid='0', outcome=1, paceadjust=1, permode=1,
     period='0', plusminus=1, seasonsegment=1, seasontype=1,
     vsconf=1, vsdiv=1, rank=1):
     self._url = "http://stats.nba.com/stats/teamdashboardbygeneralsplits?"
     self._api_param = {'TeamID':teamid,
                         'Season': _nbaSeason(season),
                         'LeagueID': _nbaLeague(league),
                         'DateFrom':datefrom,
                         'DateTo':dateto,
                         'GameSegment':_GameSegment(gamesegment),
                         'LastNGames':lastngames,
                         'Location':_Location(location),
                         'MeasureType': _measureType(measuretype),
                         'Month':month,
                         'OpponentTeamID':opponentteamid,
                         'Outcome':_Outcome(outcome),
                         'PaceAdjust':_PaceAdjust(paceadjust),
                         'PerMode':_PerMode(permode),
                         'Period':period,
                         'PlusMinus':_PlusMinus(plusminus),
                         'Rank':_Rank(rank),
                         'SeasonSegment':_SeasonSegment(seasonsegment),
                         'SeasonType':_SeasonType(seasontype),
                         'VsConference':_VsConference(vsconf),
                         'VsDivision':_VsDivision(vsdiv)
                         }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#5
0
 def __init__(
     self,
     stattype="Team",
     datefrom="",
     dateto="",
     gamescope=1,
     gamesegment=1,
     lastngames="0",
     league="NBA",
     location=1,
     measuretype=1,
     month="0",
     opponentteamid="0",
     outcome=1,
     paceadjust=1,
     permode=1,
     period="0",
     playerexperience=1,
     playerposition=1,
     plusminus=1,
     rank=1,
     season="2014",
     seasonsegment=1,
     seasontype=1,
     starterbench=1,
     vsconf=1,
     vsdiv=1,
 ):
     if stattype.lower() == "team":
         self._url = "http://stats.nba.com/stats/leaguedashteamstats?"
     else:
         self._url = "http://stats.nba.com/stats/leaguedashplayerstats?"
     self._api_param = {
         "DateFrom": datefrom,
         "DateTo": dateto,
         "GameScope": _GameScope(gamescope),
         "GameSegment": _GameSegment(gamesegment),
         "LastNGames": lastngames,
         "LeagueID": _nbaLeague(league),
         "Location": _Location(location),
         "MeasureType": _measureType(measuretype),
         "Month": month,
         "OpponentTeamID": opponentteamid,
         "Outcome": _Outcome(outcome),
         "PaceAdjust": _PaceAdjust(paceadjust),
         "PerMode": _PerMode(permode),
         "Period": period,
         "PlayerExperience": _PlayerExperience(playerexperience),
         "PlayerPosition": _PlayerPosition(playerposition),
         "PlusMinus": _PlusMinus(plusminus),
         "Rank": _Rank(rank),
         "Season": _nbaSeason(season),
         "SeasonSegment": _SeasonSegment(seasonsegment),
         "SeasonType": _SeasonType(seasontype),
         "StarterBench": _StarterBench(starterbench),
         "VsConference": _VsConference(vsconf),
         "VsDivision": VsDivision(vsdiv),
     }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#6
0
 def __init__(self, teamid, season='2014',league='NBA', seasontype=1):
     self._url = "http://stats.nba.com/stats/teaminfocommon?"
     self._api_param = {'TeamID':teamid,
                         'LeagueID': _nbaLeague(league),
                         'SeasonType':_SeasonType(seasontype),
                         'Season': _nbaSeason(season)
                         }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#7
0
 def __init__(self, teamid, permode=1,league='NBA', seasontype=1):
     self._url = "http://stats.nba.com/stats/teamyearbyyearstats?"
     self._api_param = {'TeamID':teamid,
                         'PerMode': _PerMode(permode),
                         'LeagueID': _nbaLeague(league),
                         'SeasonType':_SeasonType(seasontype)
                         }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#8
0
 def __init__(self, playerid, season="2014", seasontype="Regular Season", league="NBA"):
     self._url = "http://stats.nba.com/stats/playergamelog?"
     self._api_param = {
         "PlayerID": playerid,
         "SeasonType": seasontype,
         "Season": _nbaSeason(season),
         "LeagueID": _nbaLeague(league),
     }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#9
0
 def __init__(
     self,
     groupsize=5,
     gameid="",
     season=2014,
     league="NBA",
     datefrom="",
     dateto="",
     measure=1,
     month=0,
     opponentteamid=0,
     paceadjust=1,
     permode=1,
     period=0,
     plusminus=1,
     rank=1,
     seasonsegment=1,
     seasontype=1,
     vsconf=1,
     vsdiv=1,
     lastngames=0,
     location=1,
     outcome=1,
 ):
     self._url = "http://stats.nba.com/stats/leaguedashlineups?"
     self._api_param = {
         "DateFrom": datefrom,
         "DateTo": dateto,
         "GameID": gameid,
         "GameSegment": _GameSegment(gamesegment),
         "GroupQuantity": groupsize,
         "LastNGames": lastngames,
         "LeagueID": _nbaLeague(league),
         "Location": _Location(location),
         "MeasureType": _measureType(measure),
         "Month": month,
         "OpponentTeamID": opponentteamid,
         "Outcome": _Outcome(outcome),
         "PaceAdjust": _PaceAdjust(paceadjust),
         "PerMode": _PerMode(permode),
         "Period": period,
         "PlusMinus": _PlusMinus(plusminus),
         "Rank": _Rank(rank),
         "Season": _nbaSeason(season),
         "SeasonSegment": _SeasonSegment(seasonsegment),
         "SeasonType": _SeasonType(seasontype),
         "VsConference": _VsConference(vsconf),
         "VsDivision": _VsDivision(vsdiv),
     }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#10
0
 def __init__(
     self,
     playerid,
     season="2014",
     seasontype="Regular Season",
     league="NBA",
     dateto="",
     datefrom="",
     gamesegment="",
     lastngames=0,
     location="",
     measuretype=1,
     month=0,
     opponentteamid=0,
     outcome="",
     paceadjust="N",
     permode="PerGame",
     period=0,
     plusminus="N",
     rank="N",
     seasonsegment="",
     vsconference="",
     vsdivision="",
 ):
     self._url = "http://stats.nba.com/stats/playerdashboardbygeneralsplits?"
     self._api_param = {
         "PlayerID": playerid,
         "SeasonType": seasontype,
         "Season": _nbaSeason(season),
         "LeagueID": _nbaLeague(league),
         "DateTo": dateto,
         "DateFrom": datefrom,
         "GameSegment": gamesegment,
         "LastNGames": lastngames,
         "Location": location,
         "MeasureType": _measureType(measuretype),
         "Month": month,
         "OpponentTeamID": opponentteamid,
         "Outcome": outcome,
         "PaceAdjust": paceadjust,
         "PerMode": permode,
         "Period": period,
         "PlusMinus": plusminus,
         "Rank": rank,
         "SeasonSegment": seasonsegment,
         "VsConference": vsconference,
         "VsDivision": vsdivision,
     }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#11
0
 def __init__(
     self,
     playerid,
     league="NBA",
     season="2014",
     seasontype="Regular Season",
     teamid=0,
     outcome="",
     location="",
     month=0,
     seasonsegment="",
     datefrom="",
     dateto="",
     opponentteamid=0,
     vsconf="",
     vsdiv="",
     gamesegment="",
     period=0,
     lastngames=0,
     permode="PerGame",
 ):
     self._url = "http://stats.nba.com/stats/playerdashptshots?"
     self._api_param = {
         "PlayerID": playerid,
         "LeagueID": _nbaLeague(league),
         "Season": _nbaSeason(season),
         "SeasonType": seasontype,
         "TeamID": teamid,
         "Outcome": outcome,
         "Location": location,
         "Month": month,
         "SeasonSegment": seasonsegment,
         "DateFrom": datefrom,
         "DateTo": dateto,
         "OpponentTeamID": opponentteamid,
         "VsConference": vsconf,
         "VsDivision": vsdiv,
         "GameSegment": gamesegment,
         "Period": period,
         "LastNGames": lastngames,
         "PerMode": permode,
     }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#12
0
 def __init__(self,teamid,league='NBA',season='2014', seasontype=1,outcome=1,location=1,month=0,
     seasonsegment=1,datefrom='',dateto='',opponentteamid=0,vsconf=1,vsdiv=1,gamesegment=1,period=0,
     lastngames=0, permode=1):
     self._url = "http://stats.nba.com/stats/teamdashptshots?"
     self._api_param = {
                     'TeamID' : teamid,
                     'LeagueID': _nbaLeague(league),
                     'Season' :  _nbaSeason(season),
                     'SeasonType' : _SeasonType(seasontype),
                     'Outcome' : _Outcome(outcome),
                     'Location' : _Location(location),
                     'Month' : month,
                     'SeasonSegment' : _SeasonSegment(seasonsegment),
                     'DateFrom' :  datefrom,
                     'DateTo' : dateto,
                     'OpponentTeamID' : opponentteamid,
                     'VsConference' : _VsConference(vsconf),
                     'VsDivision' : _VsDivision(vsdiv),
                     'GameSegment' : _GameSegment(gamesegment),
                     'Period' : period,
                     'LastNGames' : lastngames,
                     'PerMode' : _PerMode(permode)
                     }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#13
0
 def __init__(self, league="NBA", season=2014):
     self._url = "http://stats.nba.com/stats/playoffpicture?"
     self._api_param = {"LeagueID": _nbaLeague(league), "SeasonID": _seasonID(season)}
     self._pull = _requests.get(self._url, params=self._api_param)
示例#14
0
 def __init__(self, league="NBA"):
     self._url = "http://stats.nba.com/stats/franchisehistory?"
     self._api_param = {"LeagueID": _nbaLeague(league)}
     self._pull = _requests.get(self._url, params=self._api_param)
示例#15
0
 def __init__(self, season='2014', league='NBA'):
     self._url = "http://stats.nba.com/stats/draftcombineplayeranthro?"
     self._api_param = {'LeagueID':_nbaLeague(league),
                        'SeasonYear':_nbaSeason(season),
     }
     self._pull = _requests.get(self._url, params=self._api_param)
示例#16
0
 def __init__(self, season='2014', league='NBA'):
     self._url = "http://stats.nba.com/stats/draftcombinenonstationaryshooting?"
     self._api_param = {'LeagueID':_nbaLeague(league),
                        'SeasonYear':_nbaSeason(season)
     }
     self._pull = requests.get(self._url, params=self._api_param)
示例#17
0
 def __init__(self, playerid, league="NBA", permode="PerGame"):
     self._url = "http://stats.nba.com/stats/playercareerstats?"
     self._api_param = {"PlayerID": playerid, "LeagueID": _nbaLeague(league), "PerMode": permode}
     self._pull = _requests.get(self._url, params=self._api_param)