Handle AttributeError when checking HTTPError code