Add exception class for HTTP/403 errors #1

Closed
stephenyeargin opened this Issue Apr 7, 2012 · 2 comments

Comments

Projects
None yet
2 participants

ESPN's API, at the moment, has horrendous rate limiting (1 call per second). Subsequent calls until an unspecified cool down period is reached return an HTTP status of 403.

On line 167,

return json_decode(file_get_contents($uri));

... should throw an exception if anything other than a result set is returned. This probably will require a bit of re-factoring, or using a cURL handle instead of file_get_contents() to catch which status code is being returned. This would allow developers to use a try { ... } catch { ... } structure in their controllers to either re-attempt the request, or give back meaningful status information to the end user.

Hopefully ESPN can get it together on their public rate limits being so low.

erikwebb commented Jul 1, 2012

+1

Closing this as the public API was 💀🔥 by ESPN. 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment