Is the API still working? Are there new headers?
Hey I'm not able to connect to any of the endpoints, I get this error...
readtimeout: httpsconnectionpool(host='stats.nba.com', port=443): read timed out. (read timeout=30)
These are the headers I'm using...
{
'Host': 'stats.nba.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.5',
'Referer': 'https://stats.nba.com/',
'Accept-Encoding': 'gzip, deflate, br',
'Connection': 'keep-alive',
'x-nba-stats-origin': 'stats',
'x-nba-stats-token': 'true'
}
Can someone help me?
I had the same problem, someone mentioned to use time.sleep() before each API call as a temp solution and that's worked for me.
Still getting timeouts when calling leagueSeasonMatchups. Only calling the API once so time.sleep() is not applicable here. Has anyone else had this problem?
yes I have the same problem.
@sbut1992 Did you find a solution ?
I have the same error!!! endpoint with required arguments are timed out!!!
What endpoints are you calling and where from? Myself and others have seen issues in running from AWS (looks like the NBA blocks calls from there). I've run through the Jupyter Notebooks locally today and haven't had any issues. If you are making consecutive calls to the api, you'll need to put in minimum sleep of time.sleep(.600)
Thanks for your response, I am using google Colab. Actually I am new in using APIs.
The code I used is: !pip install nba_api from nba_api.stats.endpoints import commonplayerinfo player_info = commonplayerinfo.CommonPlayerInfo(player_id=2544)
I am getting the error: ReadTimeout: HTTPSConnectionPool(host='stats.nba.com', port=443): Read timed out. (read timeout=30)
but I could call another endpoint without any attributes(only this one): !pip install nba_api from nba_api.stats.endpoints import assistleaders player_info = assistleaders.AssistLeaders() player_info.assist_leaders.get_data_frame() I got the required output for the above code.
May be my code might be wrong.Can you give the basic code for calling these endpoints. Thank you Sir.
Also having timeout issues myself right now
times out when using postman or from my Django server being run locally. works fine with curl though
@JSK25 - I had to connect Google Colab to my local Jupyter runtime in order to be successful. Myself and several others have run into issues where the NBA appears to have blocked cloud providers.
I was able to get up and running by connecting Google Colab to my local environment and pass my calls through there. It's a bit complicated, but it works. Given that you are running through your local, I'm not certain how much that buys you though as you might as well just run Jupyter locally rather than through Google Colab.
Here's the docs for that. https://research.google.com/colaboratory/local-runtimes.html
As for the others, I'm not having any issues in connecting and working with data. Again, everything is of my local box and not running on a cloud provider.
I have tried my code on Jupiter also. But didn't worked out. Actually what am I missing out?