Skip to main content

Library for working with Superfeedr's PubSubHubbub API

Project description

A simple library designed to make it easy to add and remove feeds from Superfeedr’s PubSubHubbub API. Includes support for hub.secret.

Credits

Developed and used at Urban Airship and released under the MIT License.

Harper Reed’s gae-superfeedr-shell provided inspiration for part of this code. Thanks Harper!

Example Usage

Setting up pubsubsuperfeedr:

>>> import pubsubsuperfeedr
>>> sf = pubsubsuperfeedr.Superfeedr(settings.SUPERFEEDR_USERNAME, settings.SUPERFEEDR_PASSWORD)

Validating a feed to make sure that it has at least one readable entry:

>>> sf.verify_feed_url("http://blog.urbanairship.com/feed/")
True

Note that this is just a really simple wrapper around feedparser and sometimes feedparser can read things that Superfeedr can’t.

Adding a feed:

>>> sf.add_feed("http://blog.urbanairship.com/feed/", "http://example.com/your_callback_url", "some_verify_token", "some_secret")

add_feed expects the feed you’re wanting to watch, then the callback URL, and optionally a verify token and feed secret.

Removing a feed:

>>> sf.remove_feed("http://blog.urbanairship.com/feed/", "http://example.com/your_callback_url", "some_secret")

Removing a feed is basically the same as adding a feed.

Verifying a secret (in Django):

>>> sf.verify_secret("some_secret", request.raw_post_data, request.META.get("HTTP_X_HUB_SIGNATURE", ""))
True

Testing

To run the tests, first make sure that nose and mox are installed. Then:

$ nosetests

And you’re off an running.

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pubsubsuperfeedr-0.4.0-py3-none-any.whl (3.7 kB) Copy SHA256 hash SHA256 Wheel py3 Jun 15, 2018
pubsubsuperfeedr-0.4.0.tar.gz (3.5 kB) Copy SHA256 hash SHA256 Source None Jun 15, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page