def ping_hub(urls):
    for i in xrange(0, len(urls), HUB_URL_BATCH_SIZE):
      chunk = urls[i:i + HUB_URL_BATCH_SIZE]
      logging.info('Pinging %s for %d URLs...' % (CONSTANTS.HUB_URL, len(chunk)))

      data = urllib.urlencode({
              'hub.url': chunk,
              'hub.mode': 'publish'
          },
          doseq=True)

      try:
          response = urllib2.urlopen(CONSTANTS.HUB_URL, data)
      except (IOError, urllib2.HTTPError), e:
          if hasattr(e, 'code') and e.code == 204:
              logging.info('...Success')
              continue
          error = ''
          if hasattr(e, 'read'):
              error = e.read()
          logging.warning('Error from hub: %s, Response: "%s"' % (e, error))
      except:
          logging.warning('Exception when pinging hub: %s' % str(sys.exc_info()[0]))
          return

      logging.info('No 204 response')
dataset/ETHPy150Open mihaip/streamspigot/app/birdfeeder/handlers/update.py/ping_hub/original