def get_html(url, config=None, response=None):
 FAIL_ENCODING = 'ISO-8859-1'
 config = (config or Configuration())
 useragent = config.browser_user_agent
 timeout = config.request_timeout
 if (response is not None):
  if (response.encoding != FAIL_ENCODING):
   return response.text
  return response.content
 try:
  html = None
  response = requests.get(url=url, **get_request_kwargs(timeout, useragent))
  if (response.encoding != FAIL_ENCODING):
   html = response.text
  else:
   html = response.content
  if config.http_success_only:
   response.raise_for_status()
  if (html is None):
   html = ''
  return html
 except requests.exceptions.RequestException as e:
  log.debug(('%s on %s' % (e, url)))
  return ''

def get_html ( url , config = None , response = None ) : FAIL_ENCODING = 'ISO-8859-1' config = ( config or Configuration ( ) ) useragent = config . browser_user_agent timeout = config . request_timeout if ( response is not None ) : if ( response . encoding != FAIL_ENCODING ) : return response . text return response . content try : html = None response = requests . get ( url = url , ** get_request_kwargs ( timeout , useragent ) ) if ( response . encoding != FAIL_ENCODING ) : html = response . text else : html = response . content if config . http_success_only : response . raise_for_status ( ) if ( html is None ) : html = '' return html except requests . exceptions . RequestException as e : log . debug ( ( '%s on %s' % ( e , url ) ) ) return ''
retrieves the html for either a url or a response object .