Closed skunkie closed 3 years ago
When getting a nonexistent attribute of a RisObject instance, instead of an AttributeError exception, a KeyError exception is raised. This is not an expected behaviour.
Example:
import redfish SYSTEM_URL = "https://10.0.0.100" LOGIN_ACCOUNT = "admin" LOGIN_PASSWORD = "password" REDFISH_OBJ = redfish.RedfishClient( base_url=SYSTEM_URL, username=LOGIN_ACCOUNT, password=LOGIN_PASSWORD ) REDFISH_OBJ.login() RESPONSE = REDFISH_OBJ.get("/redfish/v1/systems/1") RESPONSE_OBJ = RESPONSE.obj print(RESPONSE_OBJ.NonExistingAttr) --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-6-a41dd91fc6ac> in <module> ----> 1 print(RESPONSE_OBJ.NonExistingAttr) KeyError: 'NonExistingAttr'
Please put the screenshot after the fix
Here is the screenshot after the fix
When getting a nonexistent attribute of a RisObject instance, instead of an AttributeError exception, a KeyError exception is raised. This is not an expected behaviour.
Example: