nba_py icon indicating copy to clipboard operation
nba_py copied to clipboard

404 on PlayerShotLog

Open DavidRSeWell opened this issue 8 years ago • 3 comments

It seems that most of the player.py endpoints are functioning however I am getting a 404 on the PlayerShotLogTracking. This same input works for PlayeerShootingSplits.

from nba_py import player

Aaron_brooks = player.get_player(first_name="Aaron",last_name="Brooks")

shot_log = player.PlayerShotLogTracking(player_id=Aaron_brooks)


HTTPError Traceback (most recent call last) in () 1 #Broken ----> 2 shot_log = player.PlayerShotLogTracking(player_id=Aaron_brooks)

/Users/befeltingu/anaconda/lib/python2.7/site-packages/nba_py/player.pyc in init(self, player_id, team_id, measure_type, per_mode, plus_minus, pace_adjust, rank, league_id, season, season_type, po_round, outcome, location, month, season_segment, date_from, date_to, opponent_team_id, vs_conference, vs_division, game_segment, period, shot_clock_range, last_n_games) 180 'ShotClockRange': shot_clock_range, 181 'LastNGames': last_n_games}, --> 182 referer='player') 183 184 def overall(self):

/Users/befeltingu/anaconda/lib/python2.7/site-packages/nba_py/init.pyc in _get_json(endpoint, params, referer) 83 headers=h) 84 # print _get.url ---> 85 _get.raise_for_status() 86 return _get.json() 87

/Users/befeltingu/anaconda/lib/python2.7/site-packages/requests/models.pyc in raise_for_status(self) 842 843 if http_error_msg: --> 844 raise HTTPError(http_error_msg, response=self) 845 846 def close(self):

HTTPError: 404 Client Error: Not Found for url: http://stats.nba.com/stats/playerdashptshotlog?PlusMinus=N&PlayerID=201566&TeamID=0&Location=&ShotClockRange=&SeasonType=Regular+Season&Season=2015-16&PaceAdjust=N&DateFrom=&VsConference=&OpponentTeamID=0&DateTo=&GameSegment=&LastNGames=0&VsDivision=&LeagueID=00&Outcome=&MeasureType=Base&PORound=0&PerMode=PerGame&SeasonSegment=&Period=0&Rank=N&Month=0

It looked as though the only required argument to pass to PlayerShotLogTracking was the player_id. So perhaps they have changed the endpoint?

DavidRSeWell avatar Nov 20 '16 21:11 DavidRSeWell

Seems like the referrer is the one to blame here, will test and have something up shortly

seemethere avatar Nov 21 '16 01:11 seemethere

My guess is that this endpoint has been removed because I can't find any pages on stats.nba.com that lead to it. Maybe it was replaced with ShotChart ?

mcdallas avatar Nov 21 '16 16:11 mcdallas

@mcdallas I still see it being used when you go to places like http://stats.nba.com/player/#!/201935/tracking/shots/

And it still shows up in the custom.min.js leading me to believe it has something to do with the headers we are sending.

edit: nevermind I'm a dummy didn't realize you were looking for playerdashptshotlog and not just playerdashptshot

seemethere avatar Nov 21 '16 17:11 seemethere