Use HTTPError.code instead of HTTPError.reason because of a bug in urllib.