Salmention Features

The process_salmention() function accepts two versions of a page: the page stored by a Webmention endpoint, and the current page.

The function compares the old and new versions of the page, looking for specified h-* objects. If it finds any, they will be added to a list.

All responses in _both_ the old and new page version are sent a Webmention notifying them that the source page has a new response.

The function returns:

  1. A list of all the new mentions that were added to the page;

  2. The Webmentions sent by the function and;

  3. A list of all the mentions that were removed from the page.

indieweb_utils.process_salmention(current_page_contents: str, original_post_contents: str, page_url: str, supported_types: list = ['h-entry'], send_upstream_webmentions: bool = True) Tuple[List[dict], List[str], List[str]][source]

Process a Salmention. Call this function only when you receive a Webmention to a page that has already received a Webmention.

Parameters:
  • url (str) – The URL of the page that received the Webmention.

  • original_post_contents (str) – The HTML contents of the original post.

  • current_page_contents (str) – The HTML contents of the current page.

Returns:

The new nested responses, the URLs of the webmentions sent, and the URLs of the deleted posts.

Return type:

Tuple[List[dict], List[str], List[str]]

Example:

from indieweb_utils import process_salmention

process_salmention('<html>...</html>', '<html>...</html>')

There are two pre-defined helper constants that you can pass in the `supported_types`_ parameter of the process_salmention() function: