seemethere / nba_py

Python client for NBA statistics located at stats.nba.com
BSD 3-Clause "New" or "Revised" License
1.05k stars 255 forks source link

404 on PlayerShotLog #60

Open DavidRSeWell opened 7 years ago

DavidRSeWell commented 7 years ago

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?
seemethere commented 7 years ago

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

mcdallas commented 7 years ago

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 ?

seemethere commented 7 years ago

@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