The above snippet is assuming your project is named 'myproject'. The first 3 variables should be obvious enough. The 4th is going to be a configuration class that the djpubsubhubbub app is going to use to talk with SuperFeedr. Continue to the next section...

Configuration

The setting PUBSUBHUBBUB_CONFIG is referencing a Python path of myproject.config.SubHubConfig. We need to create a file named config.py in your myproject directory. It should contain the following:

This will tell the djpubsubhubbub app that whenever it's talking to the SuperFeedr Hub URL, to add the authorization headers to the request, which is required by SuperFeedr.

Note: The second method above (get_default_callback_host) is optional and only necessary if you don't want to use the Django sites framework. By default, if this method is not provided, djpubsubhubbub will simply call Site.objects.get_current() to get the current FQDN to use in the callback URL. For more info, see Django Sites Documentation.

Signals

The djpubsubhubbub app uses Django signals to let you know when new content has been posted. The signal name is updated. How to use signals is beyond the scope of this tutorial, but you can read the documentation here: Django Signals.

Here is a generic example:

fromdjpubsubhubbub.signalsimportupdateddefupdate_handler(sender,update,**kwargs):''' Process new content being provided from SuperFeedr '''forentryinupdate.entries:# do something with entry hereupdated.connect(update_handler,dispatch_uid='superfeedr')