def _is_url_dns(urlstr):
 url = qurl_from_user_input(urlstr)
 assert url.isValid()
 if (utils.raises(ValueError, ipaddress.ip_address, urlstr) and (not QHostAddress(urlstr).isNull())):
  log.url.debug('Bogus IP URL -> False')
  return False
 host = url.host()
 if (not host):
  log.url.debug('URL has no host -> False')
  return False
 log.url.debug('Doing DNS request for {}'.format(host))
 info = QHostInfo.fromName(host)
 return (not info.error())

def _is_url_dns ( urlstr ) : url = qurl_from_user_input ( urlstr ) assert url . isValid ( ) if ( utils . raises ( ValueError , ipaddress . ip_address , urlstr ) and ( not QHostAddress ( urlstr ) . isNull ( ) ) ) : log . url . debug ( 'Bogus IP URL -> False' ) return False host = url . host ( ) if ( not host ) : log . url . debug ( 'URL has no host -> False' ) return False log . url . debug ( 'Doing DNS request for {}' . format ( host ) ) info = QHostInfo . fromName ( host ) return ( not info . error ( ) )
check if a url is really a url via dns .