This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

SubHub is a Django application that implements a `PubSubHubBub`_ hub. Think
of it as a push mechanism that your personal site uses to notify subscribers
about changes in feeds that your site publishes.

.. note:: SubHub works only for Atom feeds. Which you should use anyway since
today there are no more reasons left to use actual RSS format for feeds.

This hub is not a standalone daemon that runs alongside your Django project.
It works as a library code sending notifications whenever you hit a "Publish"
button. It does, however, requires a cron job to process pending subscriptions
and failed notifications.

.. _PubSubHubBub:


1. Install SubHub using your favorite package manager or simply with ``python install``.

2. Include it "subhub" into INSTALLED_APPS in your Django settings and run
``./ syncdb`` to create new tables.

3. Include SubHub urls into your project's urlconf under some sensible name::

urlpatterns = patterns('',
(r'^hub/', include('subhub.urls')),

4. Setup a cron job that will process pending subscriptions and distribute
failed notifications::

# Process subscriptions every 3 hours
0 */3 * * * user /path/to/ subhub_maintenance --subscribe

# Distribute notifications every 15 minutes
*/15 * * * * user /path/to/ subhub_maintenance --distribute

Announcing your hub

In order to tell your potential subscribers that your feeds use PubSubHubBub
notifications you should include a link to a SubHub subscription view into
your Atom feeds. It looks a bit heavy but don't let it scare you off!

First thing to do is to subclass Django's built-in Atom feed generator and
teach it to look for hub links defined in your specific feed definitions::

from django.utils.feedgenerator import Atom1Feed

class HubAtom1Feed(Atom1Feed):
def add_root_elements(self, handler):
super(HubAtom1Feed, self).add_root_elements(handler)
hub_link = self.feed.get('hub_link')
if hub_link is not None:
handler.addQuickElement(u'link', '', {
u'rel': u'hub',
u'href': hub_link,

Then in each your feed for which you want to use notifications define a link::

from django.contrib.syndication import views

class MyBlogFeed(views.Feed):
feed_type = HubAtom1Feed

def feed_extra_kwargs(self, obj):
return {
'hub_link': absolute_url(reverse('subhub-hub')),

Chances are that you already have a function like ``absolute_url`` in your
project. It should make an URL absolute adding a scheme and a domain.

Publishing new and changed items

To publish newly created or updated post you call function ``subhub.publish``
passing it two parameters:

- a list of feeds ("topics" in PubSubHubBub parlance) that this post appears in
- an entry_id for a post which in most cases is its absolute URL


import subhub

class Post(models.Model):

def save(self, **kwargs):
super(Post, self).save(**kwargs)
if self.published:
if transaction.is_managed():
topics = ['/blog/feed/'] # don't hardcode URLs, use 'reverse'
[absolute_url(t) for t in topics],

You can call "publish" from anywhere you find suitable. Just make sure that
before the call you commit a DB transaction if you use one. This is needed
because SubHub will make a separate HTTP request into your own server to fetch
an updated feed.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
SubHub-0.1.0.tar.gz (9.0 kB) Copy SHA256 Checksum SHA256 Source Mar 23, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting