{ "info": { "author": "Ivan Sagalaev", "author_email": "Maniac@SoftwareManiacs.Org", "bugtrack_url": null, "classifiers": [], "description": "======\nSubHub\n======\n\nSubHub is a Django application that implements a `PubSubHubBub`_ hub. Think\nof it as a push mechanism that your personal site uses to notify subscribers\nabout changes in feeds that your site publishes.\n\n.. note:: SubHub works only for Atom feeds. Which you should use anyway since\ntoday there are no more reasons left to use actual RSS format for feeds.\n\nThis hub is not a standalone daemon that runs alongside your Django project.\nIt works as a library code sending notifications whenever you hit a \"Publish\"\nbutton. It does, however, requires a cron job to process pending subscriptions\nand failed notifications.\n\n.. _PubSubHubBub: http://code.google.com/p/pubsubhubbub/\n\n\nInstallation\n============\n\n1. Install SubHub using your favorite package manager or simply with ``python\nsetup.py install``.\n\n2. Include it \"subhub\" into INSTALLED_APPS in your Django settings and run\n``./manage.py syncdb`` to create new tables.\n\n3. Include SubHub urls into your project's urlconf under some sensible name::\n\n urlpatterns = patterns('',\n ...\n (r'^hub/', include('subhub.urls')),\n )\n\n4. Setup a cron job that will process pending subscriptions and distribute\nfailed notifications::\n\n # Process subscriptions every 3 hours\n 0 */3 * * * user /path/to/manage.py subhub_maintenance --subscribe\n\n # Distribute notifications every 15 minutes\n */15 * * * * user /path/to/manage.py subhub_maintenance --distribute\n\n\nAnnouncing your hub\n===================\n\nIn order to tell your potential subscribers that your feeds use PubSubHubBub\nnotifications you should include a link to a SubHub subscription view into\nyour Atom feeds. It looks a bit heavy but don't let it scare you off!\n\nFirst thing to do is to subclass Django's built-in Atom feed generator and\nteach it to look for hub links defined in your specific feed definitions::\n\n from django.utils.feedgenerator import Atom1Feed\n\n class HubAtom1Feed(Atom1Feed):\n def add_root_elements(self, handler):\n super(HubAtom1Feed, self).add_root_elements(handler)\n hub_link = self.feed.get('hub_link')\n if hub_link is not None:\n handler.addQuickElement(u'link', '', {\n u'rel': u'hub',\n u'href': hub_link,\n })\n\nThen in each your feed for which you want to use notifications define a link::\n\n from django.contrib.syndication import views\n\n class MyBlogFeed(views.Feed):\n feed_type = HubAtom1Feed\n\n def feed_extra_kwargs(self, obj):\n return {\n 'hub_link': absolute_url(reverse('subhub-hub')),\n }\n\nChances are that you already have a function like ``absolute_url`` in your\nproject. It should make an URL absolute adding a scheme and a domain.\n\n\nPublishing new and changed items\n================================\n\nTo publish newly created or updated post you call function ``subhub.publish``\npassing it two parameters:\n\n- a list of feeds (\"topics\" in PubSubHubBub parlance) that this post appears in\n- an entry_id for a post which in most cases is its absolute URL\n\nExample::\n\n import subhub\n\n class Post(models.Model):\n\n def save(self, **kwargs):\n super(Post, self).save(**kwargs)\n if self.published:\n if transaction.is_managed():\n transaction.commit()\n topics = ['/blog/feed/'] # don't hardcode URLs, use 'reverse'\n subhub.publish(\n [absolute_url(t) for t in topics],\n absolute_url(self.get_absolute_url()),\n )\n\nYou can call \"publish\" from anywhere you find suitable. Just make sure that\nbefore the call you commit a DB transaction if you use one. This is needed\nbecause SubHub will make a separate HTTP request into your own server to fetch\nan updated feed.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://launchpad.net/subhub", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "SubHub", "package_url": "https://pypi.org/project/SubHub/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/SubHub/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://launchpad.net/subhub" }, "release_url": "https://pypi.org/project/SubHub/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "A simple personal PSHB hub for use in Django projects for your own blog. Doesn't serve as a public hub for publishers, hence just \"SubHub\".", "version": "0.1.0" }, "last_serial": 161324, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a7fb1c97e192b27accdba654c638efa0", "sha256": "ac0247f2caeb400af88cb2b431890390c83775e673203a703968554f4f2cb431" }, "downloads": -1, "filename": "SubHub-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a7fb1c97e192b27accdba654c638efa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8999, "upload_time": "2010-03-23T23:38:36", "url": "https://files.pythonhosted.org/packages/32/19/2d26ba0b4127846c516ad7e1967ab71f2a102a280a5214b74ab2176d4054/SubHub-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a7fb1c97e192b27accdba654c638efa0", "sha256": "ac0247f2caeb400af88cb2b431890390c83775e673203a703968554f4f2cb431" }, "downloads": -1, "filename": "SubHub-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a7fb1c97e192b27accdba654c638efa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8999, "upload_time": "2010-03-23T23:38:36", "url": "https://files.pythonhosted.org/packages/32/19/2d26ba0b4127846c516ad7e1967ab71f2a102a280a5214b74ab2176d4054/SubHub-0.1.0.tar.gz" } ] }