Thanks. That worked well. The client has been receiving data for a few hours now.
https://pubsubhubbub.appspot.com/subscription-details still shows 100% error rate though. Is this sufficient to acknowledge we successfully received the POST?? : def do_POST(self, *args, **kwargs): self.send_response(200) self.end_headers() self.wfile.write("") On Fri, Oct 1, 2010 at 12:56 PM, Brett Slatkin <[email protected]> wrote: > http://docs.python.org/release/2.5.2/lib/module-SocketServer.html > > I think you need the ThreadingMixIn. > > On Fri, Oct 1, 2010 at 12:15 PM, Dave <[email protected]> wrote: >> I've tried writing a simple python client that doesn't require the >> appengine sdk. It runs for around 90 seconds saving the buzz firehose >> to a file and then stops. >> >> https://pubsubhubbub.appspot.com/ then displays: >> >> Delivery to domain: BLOCKED >> Delivery short-term: 100% errors >> >> Does anyone have any ideas on how to fix this, or a working python >> client that isn't built on appengine? >> >> Thanks >> - dave >> >> >> >> <code> >> >> import cgi >> import urllib >> from urlparse import parse_qs, urlparse >> import BaseHTTPServer >> >> callback = "http://xxxxxxxxxx.com:8444/" >> topic ="https://www.googleapis.com/buzz/v1/activities/@all/@public" >> verify = "async" >> mode = "subscribe" >> >> class PubSubHandler(BaseHTTPServer.BaseHTTPRequestHandler): >> def do_GET(self, *args, **kwargs): >> print "do_GET" >> parsed = urlparse(self.path) >> query = parse_qs(parsed.query) >> >> self.send_response(202) >> self.end_headers() >> print query['hub.challenge'][0] >> self.wfile.write(query['hub.challenge'][0]) >> return >> >> def do_POST(self, *args, **kwargs): >> print "do_POST" >> self.send_response(200) >> self.end_headers() >> self.wfile.write("") >> data = self.rfile.read() >> f.write(data) >> print "...processed" >> return >> >> def subscribe(): >> result = urllib.urlopen("http://pubsubhubbub.appspot.com/subscribe", >> urllib.urlencode({ >> "hub.callback":callback, >> "hub.topic":topic, >> "hub.verify":verify, >> "hub.mode":mode,})) >> print "subscribe - " + result.read() >> >> f = open('/tmp/buzz', 'a') >> httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 8444), PubSubHandler) >> httpd.serve_forever() >> >
