F5Networks / f5-icontrol-rest-python

Generic python library used by the F5 SDK and other F5 projects to communicate with BIG-IP® via the REST API
http://icontrol.readthedocs.org/en/latest/
Apache License 2.0
36 stars 32 forks source link

Make it configurable whether to throw exceptions on status codes #176

Closed chen23 closed 4 years ago

chen23 commented 4 years ago

Ideally this library would not throw exceptions for anything other than a 200/209 status code. To prevent this breaking current usage it would be nice to make this configurable and have an option to override (i.e. do_not_throw_exceptions_for_non_200_209_status_codes=true).

https://github.com/F5Networks/f5-icontrol-rest-python/blob/a43909ad4978bac5f4f29bc0380e025b3c8da127/icontrol/session.py#L289

f5-rahm commented 4 years ago

@chen23 if a binary kwarg, is there a status code you DO want to error on even if overriding?

chen23 commented 4 years ago

how about: disable_icr_http_error=False and that would become

if not self.disable_icr_http_error and not in range(200,207):

f5-rahm commented 4 years ago

@chen23 will you test my PR and send me the details?

f5-rahm commented 4 years ago

archiving this repo, this request will not be implemented.