ButterCMS / buttercms-python

Python API client for ButterCMS (https://buttercms.com)
MIT License
36 stars 11 forks source link

Error checking #5

Closed adamchainz closed 1 year ago

adamchainz commented 2 years ago

Currently Client.api_get assumes the response it retrieves is a success. There should be error checking like if response.status_code != 200: raise HttpError().

( Avoid response.raise_for_status(), which only raises an error for definitely-error codes. For your API, you know that if you receive anything other than 200 then something has gone wrong.)