Closed matago closed 8 years ago
So it looks like the NBA adjusted the api calls by changing the names of fields and how they need to be passed.
I'll start working through updating these immediately and push updates as I go. All updates will be logged in this issue.
Actually, they didn't change the API parameters.
I think there may be issues with the reliabilty of the api. When i tried to get player lists, the first time I got an error. I was then able to pull it through the site by going to stats.nba.com. After I went to the site via browser, I tried to get the player lists again using goldsberry and was able to get the exact list I wanted.
I think this problem my be purely with the NBA. Nonetheless, I'll keep investigating to figure out how to replicate the problem and what steps need to be taken to correct the problem If anyone else has any intuition, it would be helpful to share here.
@bradleyfay I don't use your library (not good enough with Python to do it), but have noticed that over last few days most pages at stats.nba.com are very slow, at least 2 seconds before you get any data most times, just thought I'd share that here in case maybe that's what's causing the issue.
I have a fix mapped out.
I need to do a bit more testing to make sure it's robust and then I need to rewrite the package. It's going to require and extensive refactor, but I'll hopefully be able to bang it out by the weekend.
On the night of the 24th, NBA has changed their api. You now have to "mimic" a browser header or you will be booted out of the api.
try
headers = {'user-agent':'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0'}
If you are using python requests, just set the header and add header=header as an option in request.get()
Also if you pull down shotlogs or rebound logs, the NBA i think has decided to eliminate public access to these resources. Things like closest defender, number of contested defenders, shot distance, and all the nice stuff in the shotlogs are now banned from public use. You can verify by checking stats.nba.com/stats/playerdashptshotlogs or reboundlogs. Sad day for stats lovers!
I started a Twitter @PyGoldsberry to make it easier to get information out and receive feedback on package.
Wholesale refactor and update to address current bugs should be done midday Saturday. Have more code to write and test but it's moving quickly.
Unfortunately it looks like @stephencronin HS uncovered a severe issue that I can't do anything about. The NBA has restricted some of the data that once existed on the site such as the advanced shooting shot logs. They've replaced them with summary statistics which, while interesting, don't lend themselves to any interesting analysis. It's sad they pulled back the data they were previously sharing.
There is a slight hope http://stats.nba.com/help/whatsnew/ Maybe its a glitch? Who knows, the data has been rendered near worthless without the logs and player tracking.
Just pushed a buggy version of the refactor. For the most part, each class is going to throw an HTTP500 error when it's instantiated. That is because I haven't set the necessary default parameters for each class.
The NBA has gone through updated their underlying data structure. It appears that there is no longer true Log Level data. Each table now points to some form of aggregation. Unfortunately, this means getting close to log level data is either an extremely tedious process made of up quite a few slightly tweaked calls to the database or impossible.
I added some functionality in this new version to descrease the pain of doing multiple calls. I'm working on a post to explain how to use the new version as well as some examples of how to tweak parameters to back into pseudo-log level.
I haven't pushed this version to PyPi yet so anyone who's intestested will have to install from the git source for now.
Just pushed an update to github with less bugs (some known ones still exist), but it's working and should give user ability to start getting data again.
I tried to push to pypi this morning, but got some weird errors. Will try again later if it didn't work. For now, go ahead and try to update py-goldsberrry through pypi and let me know if it's working and threw a weird error for no reason or if version .7 hasn't made it out yet.
Should be fixed.
All API requests are producing no json detected errors. Issue appears to be occurring for many NBA API users but thought useful to post here.