(response)
return response_dict.get('message', str(response_dict))
Return a formatted message string from the response text.

    Args:
        response (requests.Response): a response object from a HTTP
            request.

    Returns:
        str: a string with the message field extracted from the
            response.text.
Return a formatted message string from the response text.
Return a formatted message string from the response text .
def _get_message(response):
    """Return a formatted message string from the response text.

    Args:
        response (requests.Response): a response object from a HTTP
            request.

    Returns:
        str: a string with the message field extracted from the
            response.text.
    """
    soup = bs4.BeautifulSoup(response.text, features='html.parser')
    if soup.p:
        return soup.p.string

    if isinstance(response.text, bytes):
        response_text = response.text.decode('utf-8')
    else:
        response_text = response.text

    try:
        response_dict = json.loads(response_text)
    except json.JSONDecodeError:
        return response_text

    if not isinstance(response_dict, dict):
        return str(response_dict)

    return response_dict.get('message', str(response_dict))
def _get_message ( response ) : soup = bs4 . BeautifulSoup ( response . text , features = 'html.parser' ) if soup . p : return soup . p . string if isinstance ( response . text , bytes ) : response_text = response . text . decode ( 'utf-8' ) else : response_text = response . text try : response_dict = json . loads ( response_text ) except json . JSONDecodeError : return response_text if not isinstance ( response_dict , dict ) : return str ( response_dict ) return response_dict . get ( 'message' , str ( response_dict ) )