def alter_content(request: HttpRequest, content: bytes) -> bytes: first_paragraph_text = get_content_description(content, request) placeholder_open_graph_description = get_request_notes( request).placeholder_open_graph_description assert placeholder_open_graph_description is not None return content.replace( placeholder_open_graph_description.encode(), first_paragraph_text.encode(), )
def alter_content(request: HttpRequest, content: bytes) -> bytes: first_paragraph_text = get_content_description(content, request) return content.replace(request.placeholder_open_graph_description.encode("utf-8"), first_paragraph_text.encode("utf-8"))