swar / nba_api

An API Client package to access the APIs for NBA.com
MIT License
2.43k stars 524 forks source link

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). #175

Open surabhip14 opened 3 years ago

surabhip14 commented 3 years ago

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.

ethanfuerst commented 3 years ago

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

surabhip14 commented 3 years ago

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

fitzeraldpaul commented 3 years ago

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

PaulLuoLi commented 3 years ago

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

jimtheflash commented 3 years ago

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 commented 11 months ago

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

iamplaga commented 11 months ago

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?

coryselzer commented 9 months ago

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