Catch HTTPError instead of URLError, since HTTPError is what defines the 'code' attribute. r=bhearsum