python-dlipower icon indicating copy to clipboard operation
python-dlipower copied to clipboard

Debug output line causes AttributeError

Open myronwalkersonos opened this issue 3 years ago • 0 comments

This line of code is causing an attibute error.

logger.debug('Response code: %s', request.status_code)

https://github.com/dwighthubbard/python-dlipower/blob/6d6c961a3da1059c42ff4abc0114b266edaf1028/dlipower/dlipower.py#L429

request is not guaranteed to have a value and so if the request fails, the code is trying to get the 'status_code' attribute of None which will result in an AttributeError exception being raised.

Example:

AttributeError: 'NoneType' object has no attribute 'status_code'

myronwalkersonos avatar Feb 25 '22 03:02 myronwalkersonos