fastly / fastly-py

A Fastly API client for Python
https://pypi.org/project/fastly/
MIT License
77 stars 60 forks source link

The set of HTTP response codes checked is incomplete #76

Closed alertedsnake closed 1 year ago

alertedsnake commented 3 years ago

In connection.py there are only a few HTTP error codes checked for: 400,401,403,404,500 but we often see several other responses, especially HTTP 502. The logic to do this checking is a little flawed, it assumes any response not caught specifically is an OK response, requiring clients to do extensive checking on each call for the extra error cases.

This logic should be rewritten to either raise specific errors for all possible cases, or to raise a default error when the status code is not 2xx.

alertedsnake commented 3 years ago

Oh - noticed one other case where it's impossible to check the result status - Model.list and Model.find don't return the result object at all, so there's no way for a program using this library to capture these errors.

Edited: spoke too soon - nearly all of the classes based on Model throw away the HTTP result object, so this would have to be done in connection.py.

Integralist commented 1 year ago

Closing this issue now we've published v1.0.0 https://pypi.org/project/fastly/