async def get_versions(self, recipe: Recipe, source: Mapping[Any, Any], source_idx: int): """Select hosters and retrieve versions for this source""" urls = source.get("url") if not urls: raise self.NoUrlInSource(recipe, source_idx + 1) if isinstance(urls, str): urls = [urls] version_map: Dict[str, Dict[str, Any]] = defaultdict(dict) for url in urls: config = self.get_config(recipe) hoster = self.hoster_factory(url, config.get("override", {})) if not hoster: self.unparsed_urls += [url] continue logger.debug("Scanning with %s", hoster.__class__.__name__) try: versions = await hoster.get_versions(self.pipeline.req, recipe.orig.version) for match in versions: match['hoster'] = hoster version_map[match["version"]][url] = match except ClientResponseError as exc: logger.debug("HTTP %s when getting %s", exc, url) if not version_map: raise self.NoRecognizedSourceUrl(recipe, source_idx + 1) return version_map
def __init__(self, scanner: Scanner, recipe_base: str, config: Dict) -> None: super().__init__(scanner) self.blacklists = config.get('blacklists') self.blacklisted = utils.get_blacklist(config, recipe_base) logger.warning("Excluding %i blacklisted recipes", len(self.blacklisted))