Skip to content

Instantly share code, notes, and snippets.

@vrypan
Created Feb 16, 2012
Embed
What would you like to do?
simple pubsubhubbub listener for superfeedr
import re
import cherrypy
import sys
class Root(object):
@cherrypy.expose
def default(self, **kwargs):
print kwargs
return 'OK'
@cherrypy.expose
def pubsub(self, **kwargs):
if 'LINK' in cherrypy.request.headers:
match = re.search('<(.*)>', cherrypy.request.headers['LINK'])
if match:
feed = match.group(1)
print 'pubsub: %s' % feed
sys.stdout.flush()
if 'hub.challenge' in kwargs:
return kwargs['hub.challenge']
else:
return 'OTHER'
cherrypy.config.update({
'server.socket_host': '0.0.0.0',
'server.socket_port': 9000,
'log.screen': False, #set this to True while testing
'checker.check_skipped_app_config':False #set this to True while testing
})
cherrypy.quickstart(Root())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment