Skip to content

Instantly share code, notes, and snippets.

@vrypan
Created February 16, 2012 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrypan/1844769 to your computer and use it in GitHub Desktop.
Save vrypan/1844769 to your computer and use it in GitHub Desktop.
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