Skip to main content

A conduit for pushing changes in a feed to the rest of the IndieWeb

Project description

Pushl

A simple tool that parses content feeds and sends out appropriate push notifications (WebSub, webmention, etc.) when they change.

See http://publ.beesbuzz.biz/blog/113-Some-thoughts-on-WebMention for the motivation.

Features

  • Will send WebSub notifications for feeds which declare a WebSub hub
  • Will send WebMention notifications for entries discovered on those feeds or specified directly
  • Can perform autodiscovery of additional feeds on entry pages
  • Can do a full backfill on Atom feeds configured with RFC 5005
  • When configured to use a cache directory, can detect entry deletions and updates to implement the webmention update and delete protocols (as well as saving some time and bandwidth)

Site setup

First, you'll want to have your Atom (or RSS) feed implement the WebSub protocol. The short version is that you should have a <link rel="hub" href="http://path/to/hub" /> in your feed's top-level element.

There are a number of WebSub hubs available; I use Superfeedr.

For WebMentions, configure your site templates with the various microformats; by default, Pushl will use the following tags as the top-level entry container, in descending order of priority:

  • Anything with a class of h-entry
  • An <article> tag
  • Anything with a class of entry

For more information on how to configure your site templates, see the microformats h-entry specification.

Installation

You can install it using pip with e.g.:

pip3 install pushl

However, I recommend installing it in a virtual environment with e.g.:

virtualenv3 $HOME/pushl
$HOME/pushl/bin/pip3 install pushl

and then putting a symlink to $HOME/pushl/bin/pushl to a directory in your $PATH, e.g.

ln -s $HOME/pushl/bin/pushl $HOME/bin/pushl

Usage

Basic

pushl -c $HOME/var/pushl-cache http://example.com/feed.xml

While you can run it without the -c argument, its use is highly recommended so that subsequent runs are both less spammy and so that it can detect changes and deletions.

Sending pings from individual entries

If you just want to send webmentions from an entry page without processing an entire feed, the -e/--entry flag indicates that the following URLs are pages or entries, rather than feeds; e.g.

pushl -e http://example.com/some/page

will simply send the webmentions for that page.

Additional feed discovery

The -r/--recurse flag will discover any additional feeds that are declared on entries and process them as well. This is useful if you have per-category feeds that you would also like to send WebSub notifications on. For example, my site has per-category feeds which are discoverable from individual entries, so pushl -r http://beesbuzz.biz/feed will send WebSub notifications for all of the categories which have recent changes.

Note that -r and -e in conjunction will also cause the feed declared on the entry page to be processed further. While it is tempting to use this in a feed autodiscovery context e.g.

pushl -re http://example.com/blog/

this will also send webmentions from the blog page itself which is probably not what you want to do.

Backfilling old content

If your feed implements RFC 5005, the -a flag will scan past entries for WebMention as well. It is recommended to only use this flag when doing an initial backfill, as it can end up taking a long time on larger sites (and possibly make endpoint operators very grumpy at you). To send updates of much older entries it's better to just use -e to do it on a case-by-case basis.

Automated updates

pushl can be run from a cron job, although it's a good idea to use flock -n to prevent multiple instances from stomping on each other. An example cron job for updating a site might look like:

*/5 * * * * flock -n $HOME/.pushl-lock pushl -rc $HOME/.pushl-cache http://example.com/feed

My setup

I use pipenv to keep my Python environments separate. My initial setup looked something like this:

mkdir $HOME/pushl
cd $HOME/pushl
pipenv install pushl

and created this script as $HOME/pushl/run.sh:

#!/bin/sh

cd $(dirname "$0")
LOG=$(date +%Y%m%d.log)
date >> $LOG
flock -n run.lock $HOME/.local/bin/pipenv run pushl -rvvc cache http://beesbuzz.biz/feed http://publ.beesbuzz.biz/feed 2>&1 | tee -a "$LOG"

Then I have a cron job:

*/5 * * * * $HOME/pushl/run.sh

which runs it every 5 minutes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Pushl-0.2.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Pushl-0.2.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file Pushl-0.2.0.tar.gz.

File metadata

  • Download URL: Pushl-0.2.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for Pushl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 daa2089affbf6f900274c8e22e0067d5af6a95edcc402237018036ec1892e780
MD5 230bc51e8bc792f18b58f7e7ca2576e8
BLAKE2b-256 229deda6071c1cde5f2c507bcda0e6d30f5098a1161d45adfbb8df802d8a47c7

See more details on using hashes here.

File details

Details for the file Pushl-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: Pushl-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for Pushl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4066b1ccfac6bb53b9fb89343dda230668704080e087a1a0c9b5bbaa7ba1555e
MD5 8b7c776220b852511f749222463449ad
BLAKE2b-256 3b1bccb1a9bf6b91e99d247120d6246e726590e307c9c9bd94cdec07b5c30b39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page