def get_unicode_from_response(r):
 warnings.warn('In requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)', DeprecationWarning)
 tried_encodings = []
 encoding = get_encoding_from_headers(r.headers)
 if encoding:
  try:
   return str(r.content, encoding)
  except UnicodeError:
   tried_encodings.append(encoding)
 try:
  return str(r.content, encoding, errors='replace')
 except TypeError:
  return r.content

def get_unicode_from_response ( r ) : warnings . warn ( 'In requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)' , DeprecationWarning ) tried_encodings = [ ] encoding = get_encoding_from_headers ( r . headers ) if encoding : try : return str ( r . content , encoding ) except UnicodeError : tried_encodings . append ( encoding ) try : return str ( r . content , encoding , errors = 'replace' ) except TypeError : return r . content
returns the requested content back in unicode .