def get_dois(self, num=1):
        start = time.time()
        dois = []
        url = "http://random.labs.crossref.org/dois?from=2000&count=" + str(num)
        logger.info(u"getting {num} random dois with IdSampler, using {url}".format(
                num=num, url=url))
        try:
            r = requests.get(url, timeout=10)
        except Timeout:
            logger.warning(u"the random doi service isn't working right now (timed out); sending back an empty list.")
            return dois

        if r.status_code == 200:
            try:
                dois = json.loads(r.text)
                logger.info(u"IdSampler got {count} random dois back in {elapsed} seconds".format(
                        count=len(dois), elapsed=round(time.time() - start, 2)))
                logger.debug(u"IdSampler got these dois back: " + str(dois))
            except __HOLE__:
                pass
        if not dois:
            logger.warning(u"the random doi service isn't working right now (got error code); sending back an empty list.")

        return dois
dataset/ETHPy150Open Impactstory/total-impact-core/totalimpact/fakes.py/IdSampler.get_dois