-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONDecodeError when hitting endpoints #5
Comments
This is the line that is leaving errors: |
What happens when you call the link in a web browser? See valid link here: https://github.com/swar/nba_api/blob/master/docs/nba_api/stats/endpoints/boxscorescoringv2.md I have a feeling you're getting limited after a few calls. |
The full error log , not just one line, would help us to find the line that is breaking. |
Here is the full error: summary = boxscoresummaryv2.BoxScoreSummaryV2(game_id=game) |
Did you run into the issue with the suggestion that I mentioned above? From your error log, what's happening is that nothing is getting returned from the API requests. So when you try to load the raw JSON into a dictionary, it fails because nothing is not valid JSON. I believe I am correct in assuming that you're getting banned / limited after a few requests. For error handling, I suggest using Let me know if you have any questions. |
As an FYI, it seems like NBA stats API is limiting users to 10 consecutive calls. I've been running a forked version of https://github.com/dblackrun/scrape_nba for the last 2 seasons to scrape the API to a local db with no issues, until today. It seems like they've upped the restrictions this time around (in addition to adding https) even if you masked the USER-AGENT in the header Here is a screenshot from logging my requests (ignore the SQLalchemy errors): EDIT: as an interesting note. using time.sleep(5) to set a delay does seem to bypass this issue. I was able to scrape all data for both of today's games with this bypass. |
I had the same error with this API and found the game_id I was using from another api call (playergamelog) was 8 chars long. I spotted on the API docs that the pattern required was ^\d{10}$ so I popped 2 leading '00' and it worked ok. |
When I hit some of the endpoints it works for the first few calls, but then i get the following error every time i try:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Has anyone else been getting this?
The text was updated successfully, but these errors were encountered: