toddrob99 / MLB-StatsAPI

Python wrapper for MLB Stats API
GNU General Public License v3.0
533 stars 100 forks source link

Use HTTPError instead of ValueError for HTTP errors? #46

Closed dowski closed 4 years ago

dowski commented 4 years ago

I noticed that if I call StatsAPI's get method and the server returns a 5xx error, the StatsAPI code raise a ValueError.

Would you be open to allowing Requests to raise an HTTPError instead? It's directly supported by the Requests API:

r.raise_for_status()

I think that the HTTPError would make it more clear to callers what went wrong. If it sounds good I'll send a small pull request.

toddrob99 commented 4 years ago

That makes sense to me. Go for it!