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()

Reply via email to