I am trying to get career stats and awards from nba_api
, but I'm getting a read timeout error.
I'm using the following as a baseline for a project.
from nba_api.stats.static import players
from nba_api.stats.endpoints import playercareerstats
from nba_api.stats.endpoints import PlayerAwards
all_players = players.get_players()
for i in all_players:
Player_id = i["id"]
Player_careerstats = playercareerstats.PlayerCareerStats(Player_id).career_totals_regular_season.get_data_frame()
awards = PlayerAwards(Player_id).get_data_frames()
However, I receive this error:
ReadTimeout: HTTPSConnectionPool(host='stats.nba.com', port=443): Read timed out. (read timeout=30)
I don't know if I am asking the nba_api
for too much information since it's every player, or maybe if it's taking too long to process. If instead of trying to collect the data for every nba player I ask a user to input a name, I am able to collect and store data for each player they input. Would appreciate any help.