dword4 / nhlapi

Documenting the publicly accessible portions of the NHL API
448 stars 56 forks source link

API Limits #21

Closed ariaceleste closed 5 years ago

ariaceleste commented 5 years ago

Does anyone know the limits on pulling data before the NHL gets angry and blacklists your IP address?

I'm uncertain of the delay, but ideally I'd like to pull the stats every 5 minutes so I can analyze during the upcoming games. I do want to be respectful, however, of the NHL providing us this information and not bombard them with requests.

Thanks for any advice you can provide.

Aria

dword4 commented 5 years ago

I've not seen any blacklisting/throttling at all so far, I have tested code against it that polls every 60 seconds (checking scores) for the entire duration of a game without any problems. I don't know a whole lot about their back end hosting the API but its clearly pretty stout from what I've seen

ariaceleste commented 5 years ago

Thank you. I'll let you know if I ever have any problems.

Kudos on the excellent work!

cblair334 commented 4 years ago

I know this is old and closed, but for future googlers... I setup some debug code and went on my happy way to the game. When I got home 5 hours later I found out I had been hammering the API ~10 times per second for the entire time due to a typo I made in my rush to hack something together before I left. I did almost 30,000 requests to the live game endpoint and got exactly 0 connection errors during that time. It's been working fine since then as well (~2 weeks).

ariaceleste commented 4 years ago

That's fantastic! Thank you for the update.

Did you say that there's an endpoint where I can get real-time data? Or are you saying that you were just hitting the endpoint for a game that was occurring live?

cblair334 commented 4 years ago

I was hitting the live game feed endpoint http://statsapi.web.nhl.com/api/v1/game/GamePK/feed/live (such as http://statsapi.web.nhl.com/api/v1/game/2019021018/feed/live from yesterday).

This updates during the game with new plays and can be used to track the ongoing game damn-near realtime.

dword4 commented 4 years ago

You could also if you were worried about pulling ALOT of data use this endpoint to get only the most recent items however this may necessitate refactoring code to take that into account

https://statsapi.web.nhl.com/api/v1/game/ID/feed/live/diffPatch?startTimecode=yyyymmdd_hhmmss