nba_api icon indicating copy to clipboard operation
nba_api copied to clipboard

Cannot access the NBA stats with API for any of the end points? Each end point gives the error: JSONDecodeError: Expecting value: line 1 column 1 (char 0).

Open surabhip14 opened this issue 5 years ago • 8 comments

What do I do, If the NBA website does not allow me to access its data any more? Looks Like am blocked from all the end points, coz no matter what end point I access, I get this error: JSONDecodeError: Expecting value: line 1 column 1 (char 0).

I did make few calls to the NBA website using the API, (Around 4-5), but then post that started getting this error. IS there a work around for this?? Any help would be highly appreciated.

surabhip14 avatar Nov 02 '20 06:11 surabhip14

Which endpoints were you trying to access? I haven't been able to access the LeagueLeaders endpoint

ethanfuerst avatar Nov 03 '20 05:11 ethanfuerst

Which endpoints were you trying to access? I haven't been able to access the LeagueLeaders endpoint

Am unable to access endpoints like: PlayerDashPtShotDefend & BoxScoreAdvancedV2

surabhip14 avatar Nov 03 '20 05:11 surabhip14

Same I've been getting JSONDecodeErrors left and right. I'll try again tomorrow.

fitzeraldpaul avatar Dec 06 '20 09:12 fitzeraldpaul

Same issue for teamgamelogs, in the self.get_request() call:

c:...\decoder.py in raw_decode(self, s, idx) 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I did some experimenting, and as far as I can tell, the problem is that the call with some provided parameters is not valid:

For example, this call returns fine:

team_log = teamgamelogs.TeamGameLogs( season_nullable = season, team_id_nullable = 1610612741, season_type_nullable = season_type
) print(team_log.team_game_logs.get_data_frame())

SEASON_YEAR TEAM_ID TEAM_ABBREVIATION TEAM_NAME GAME_ID
0 2017-18 1610612741 CHI Chicago Bulls 0021701224
1 2017-18 1610612741 CHI Chicago Bulls 0021701205
2 2017-18 1610612741 CHI Chicago Bulls 0021701193

However, if I add any date to it, it gets the JSONDecodeError:
team_log = teamgamelogs.TeamGameLogs( season_nullable = season, team_id_nullable = 1610612741, season_type_nullable = season_type, date_from_nullable = '2018-01-17' ) print(team_log.team_game_logs.get_data_frame())


JSONDecodeError Traceback (most recent call last)

I can't figure out why this is happening, because the exact same call with some other end points do work:

league_log = leaguegamelog.LeagueGameLog( counter=1, direction='ASC', player_or_team_abbreviation = 'T', season = season, season_type_all_star= season_type, sorter = 'DATE', date_from_nullable = '2018-01-17' ) logs = league_log.league_game_log.get_data_frame() print(logs)

 SEASON_ID     TEAM_ID TEAM_ABBREVIATION              TEAM_NAME  \

0 22017 1610612741 CHI Chicago Bulls
1 22017 1610612744 GSW Golden State Warriors

PaulLuoLi avatar Dec 23 '20 00:12 PaulLuoLi

I'm getting this now for the PlayByPlayV2 endpoint, but not the PlayerGameLogs endpoint. @surabhip14 did this issue resolve itself by trying again later, or was there a different fix recommended?

jimtheflash avatar Feb 10 '21 13:02 jimtheflash

it sucks there is no genius at the end of this rainbow.. i swore I found the answer finally.

iamplaga avatar Sep 19 '23 18:09 iamplaga

I'm getting this now for the PlayByPlayV2 endpoint, but not the PlayerGameLogs endpoint. @surabhip14 did this issue resolve itself by trying again later, or was there a different fix recommended?

iamplaga avatar Sep 19 '23 18:09 iamplaga

@iamplaga I am having this error trying to use TeamYearByYearStats. Any solution?

coryselzer avatar Nov 21 '23 00:11 coryselzer