Added a check for HTTPErrors without a 'reason' attribute

For example, HTTP Error 403 does not have a 'reason' attribute, in this case the script throws an error and exits