@defer.inlineCallbacks
    def _downloadMicrodescriptorBlock(self, block, v2dirs):
        descs = set()
        for d in block:
            try:
                tmp = b64encode(d.decode('hex')).rstrip('=')
                descs.add(tmp)
            except __HOLE__:
                msg = "Malformed descriptor {}. Discarding.".format(d)
                logging.debug(msg)

        dircaches = list(v2dirs)

        for _ in xrange(len(dircaches)):
            dircache = random.choice(dircaches)
            url = _makeDescDownloadURL(dircache, descs)
            try:
                result = yield getPage(url, timeout=TIMEOUT)
                # descs set to leftover descriptors that weren't received
                descs = self._processMicrodescriptorBlockResult(result, descs)
                if len(descs) == 0:
                    break
            except Exception:
                # if a download fails, try again at a different dircache
                dircaches.remove(dircache)

        if len(descs) != 0:
            msg = ("Tried all V2Dir caches and failed to download the "
                   "descriptors with digests: {}".format(' '.join(descs)))
            logging.debug(msg)

        defer.returnValue(None)
dataset/ETHPy150Open nskinkel/oppy/oppy/netstatus/microdescriptormanager.py/MicrodescriptorManager._downloadMicrodescriptorBlock