def data_for_url(url):
 path = url.path()
 host = url.host()
 log.misc.debug('url: {}, path: {}, host {}'.format(url.toDisplayString(), path, host))
 try:
  handler = _HANDLERS[path]
 except KeyError:
  try:
   handler = _HANDLERS[host]
  except KeyError:
   raise NoHandlerFound(url)
 try:
  (mimetype, data) = handler(url)
 except OSError as e:
  raise QuteSchemeOSError(e)
 except QuteSchemeError as e:
  raise
 assert (mimetype is not None), url
 if ((mimetype == 'text/html') and isinstance(data, str)):
  data = data.encode('utf-8', errors='xmlcharrefreplace')
 return (mimetype, data)

def data_for_url ( url ) : path = url . path ( ) host = url . host ( ) log . misc . debug ( 'url: {}, path: {}, host {}' . format ( url . toDisplayString ( ) , path , host ) ) try : handler = _HANDLERS [ path ] except KeyError : try : handler = _HANDLERS [ host ] except KeyError : raise NoHandlerFound ( url ) try : ( mimetype , data ) = handler ( url ) except OSError as e : raise QuteSchemeOSError ( e ) except QuteSchemeError as e : raise assert ( mimetype is not None ) , url if ( ( mimetype == 'text/html' ) and isinstance ( data , str ) ) : data = data . encode ( 'utf-8' , errors = 'xmlcharrefreplace' ) return ( mimetype , data )
get the data to show for the given url .