why don't raise value immediately in requestor.py if the request didn't return successful result? instead of checking it manually (by the user of this library manually) ?
response.status_code == 200:
try:
return response.json()
except ValueError:
# GET /system/version
return response.text
else:
return { # <------ why not raise exception?
'reason': response.reason,
'status_code': response.status_code,
'url': response.request.url
}
why not raise ValueError("eror ...") ? so that the user know something wrong happened.
With current design we need to check every time if the response contains 'status_code' or not.
Thanks for admin-api.
why don't raise value immediately in requestor.py if the request didn't return successful result? instead of checking it manually (by the user of this library manually) ?
why not
raise ValueError("eror ...")? so that the user know something wrong happened.With current design we need to check every time if the response contains 'status_code' or not.
Thanks for
admin-api.