def _get_release_info(self, name, version):
    self._log('Getting info for {} ({}) from PyPI'.format(name, version), 'debug')
    json_data = self._get('pypi/{}/{}/json'.format(name, version))
    if (json_data is None):
        raise PackageNotFound('Package [{}] not found.'.format(name))
    info = json_data['info']
    data = PackageInfo(name=info['name'], version=info['version'], summary=info['summary'], platform=info['platform'], requires_dist=info['requires_dist'], requires_python=info['requires_python'], files=info.get('files', []), cache_version=str(self.CACHE_VERSION))
    try:
        version_info = json_data['releases'][version]
    except KeyError:
        version_info = []
    for file_info in version_info:
        data.files.append({'file': file_info['filename'], 'hash': ('sha256:' + file_info['digests']['sha256'])})
    if (self._fallback and (data.requires_dist is None)):
        self._log('No dependencies found, downloading archives', level='debug')
        urls = defaultdict(list)
        for url in json_data['urls']:
            dist_type = url['packagetype']
            if (dist_type not in ['sdist', 'bdist_wheel']):
                continue
            urls[dist_type].append(url['url'])
        if (not urls):
            return data.asdict()
        info = self._get_info_from_urls(urls)
        data.requires_dist = info.requires_dist
        if (not data.requires_python):
            data.requires_python = info.requires_python
    return data.asdict()
def _get_release_info(self, name, version):
    self._log('Getting info for {} ({}) from PyPI'.format(name, version), 'debug')
    json_data = self._get('pypi/{}/{}/json'.format(name, version))
    if (json_data is None):
        raise PackageNotFound('Package [{}] not found.'.format(name))
    info = json_data['info']
    data = PackageInfo(name=info['name'], version=info['version'], summary=info['summary'], platform=info['platform'], requires_dist=info['requires_dist'], requires_python=info['requires_python'], files=info.get('files', []), cache_version=str(self.CACHE_VERSION))
    try:
        version_info = json_data['releases'][version]
    except KeyError:
        version_info = []
    for file_info in version_info:
        data.files.append({'file': file_info['filename'], 'hash': ('sha256:' + file_info['digests']['sha256'])})
    if (self._fallback and (data.requires_dist is None)):
        self._log('No dependencies found, downloading archives', level='debug')
        urls = defaultdict(list)
        for url in json_data['urls']:
            dist_type = url['packagetype']
            if (dist_type not in ['sdist', 'bdist_wheel']):
                continue
            urls[dist_type].append(url['url'])
        if (not urls):
            return data.asdict()
        info = self._get_info_from_urls(urls)
        data.requires_dist = info.requires_dist
        if (not data.requires_python):
            data.requires_python = info.requires_python
    return data.asdict()