def query_lookupd(self):
        self.logger.debug('querying lookupd...')
        lookupd = next(self.iterlookupds)

        try:
            producers = lookupd.lookup(self.topic)['producers']
            self.logger.debug('found %d producers' % len(producers))

        except Exception as error:
            msg = 'Failed to lookup %s on %s (%s)'
            self.logger.warn(msg % (self.topic, lookupd.address, error))
            return

        for producer in producers:
            conn = Nsqd(
                producer.get('broadcast_address') or producer['address'],
                producer['tcp_port'],
                producer['http_port'],
                **self.conn_kwargs
            )
            self.connect_to_nsqd(conn)
dataset/ETHPy150Open wtolson/gnsq/gnsq/reader.py/Reader.query_lookupd/original