:raise urllib2.URLError | urllib.error.URLError: When
    :return:
488801
def get_impediments():
    
    file = urlopen(XML_URL)

    doc = dom.parse(file)
    xml = doc.documentElement

    nodes = xml.getElementsByTagName('utr')
    impediments = [extract(node) for node in nodes]

    return impediments
525989
def _raise_error(self, status_code, raw_data):
        
        error_message = raw_data
        additional_info = None
        try:
            if raw_data:
                additional_info = json.loads(raw_data)
                error_message = additional_info.get('error', error_message)
                if isinstance(error_message, dict) and 'type' in error_message:
                    error_message = error_message['type']
        except (ValueError, TypeError) as err:
            logger.warning('Undecodable raw error response from server: %s', err)

        raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
992282
def _handle_client_exception():
    
    try:
        yield

    except _ClientException as exception:
        if exception.http_status in _ERROR_CODES:
            raise _ERROR_CODES[exception.http_status](
                exception.http_reason)
        raise
1214873
def skip_http_error(statuses):
    '''
    
    '''

    assert isinstance(statuses, tuple)

    def decorator(func):
        def wrapper(*args, **kwargs):
            try:
                return func(*args, **kwargs)
            except HTTPError as e:
                status_code = e.response.status_code
                if status_code in statuses:
                    log.warn(str(e))
                else:
                    raise
        return wrapper
    return decorator
1338933
def UrlGet(url, timeout=10, retries=0):
  
   # in Python 2.6 we can pass timeout to urllib2.urlopen
  socket.setdefaulttimeout(timeout)
  attempts = 0
  content = None
  while not content:
      try:
          content = urllib2.urlopen(url).read()
      except urllib2.URLError:
          attempts = attempts + 1
          if attempts > retries:
              raise IOError('Failed to fetch url: %s' % url)
  return content
97541
def raise_if(self, exception, message, *args, **kwargs):
        
        if issubclass(exception, self.minimum_defect):
            raise exception(*args, **kwargs)
        warn(message, SyntaxWarning, *args, **kwargs)
649893
def check_url(url):
        '''
        

        '''
        request = urllib2.Request(url)
        try:
            response = urlopen(request)
            return True, response.code
        except urllib2.HTTPError as e:
            return False, e.code
1343528
def retryable_http_error( e ):
    
    if isinstance( e, urllib.error.HTTPError ) and e.code in ('503', '408', '500'):
        # The server returned one of:
        # 503 Service Unavailable
        # 408 Request Timeout
        # 500 Internal Server Error
        return True
    if isinstance( e, BadStatusLine ):
        # The server didn't return a valid response at all
        return True
    return False
994798
def _raise_for_remote_status(url: str, data: dict) -> None:
    """"""
    if data.get('errorType') and data['errorType'] > 0:
        raise_remote_error(data['errorType'])

    if data.get('statusCode') and data['statusCode'] != 200:
        raise RequestError(
            'Error requesting data from {0}: {1} {2}'.format(
                url, data['statusCode'], data['message']))
230445
def raise_error(name=None, args=None, message=''):
    '''
    
    '''
    name = name or 'Exception'
    if hasattr(salt.exceptions, name):
        ex = getattr(salt.exceptions, name)
    elif hasattr(exceptions, name):
        ex = getattr(exceptions, name)
    else:
        name = 'SaltException'
        ex = getattr(salt.exceptions, name)
    if args is not None:
        raise ex(*args)
    else:
        raise ex(message)
556832
def raises(cls, sender, attrname, error, args=ANYTHING, kwargs=ANYTHING):
        ""
        def raise_error():
            raise error
        return cls(sender, attrname, returns=Invoke(raise_error), args=ANYTHING, kwargs=ANYTHING)
731202
def raise_error(self, status=500, message="Generic server error.  Out of luck..."):
        
        self.set_status(status)
        self.write({"message" : message,
                    "status" : status})
452040
def error_response(self, exception):
        # type: (Exception) -> Tuple[Callback, Error]
        """"""
        response = Error(id=self.id, message=exception)
        log.exception("Exception raised for request %s", self)
        return self.callback, response
58718
def setUrl(self, url):
        
        if isUrl(url):
            self._url = url
        else:
            raise exceptions.BadUrlException(url)
        return self
860521
def _handle_http_errors(response):
    
    code = response.status_code
    if 200 <= code < 400:
        return response
    elif code in (403, 404):
        raise {403: _ObjectPermissionError,
               404: _ObjectNotFoundError}[code](response.reason)
    response.raise_for_status()
41476
def _raise_on_error(data):
    """"""
    if isinstance(data, list):
        data = data[0]

    if isinstance(data, dict) and 'error' in data:
        raise_error(data['error'])
789305
def default_match_error_handler(exc):
    
    if isinstance(exc, NotFound):
        return http.NotFound()
    elif isinstance(exc, MethodNotAllowed):
        return http.MethodNotAllowed()
    elif isinstance(exc, RequestRedirect):
        return redirect(exc.new_url)
    else:
        raise exc