def __call__(self, value, system):

        if 'request' in system:
            request = system['request']
            filename = value['filename']

            mime, encoding = mimetypes.guess_type(filename)

            request.response.content_type = mime
            if encoding:
                request.response.encoding = encoding

            localpath = os.path.join(self.repository_root, filename[0].lower(),
                                     filename)

            if not os.path.exists(localpath):
                sdistpath = os.path.join(self.repository_root,
                                         value['original'][0].lower(),
                                         value['original'])

                dir_ = os.path.join(self.repository_root,
                                    value['original'][0].lower())
                if not os.path.exists(dir_):
                    os.makedirs(dir_, 0o750)

                verify = value['url'].startswith('https:')

                log.info('Downloading {0}'.format(value['url']))
                resp = requests.get(value['url'], verify=verify)
                if resp.status_code == 404:
                    raise NotFound('Resource {0} not found'.format(value['original']))
                resp.raise_for_status()
                with open(sdistpath, 'wb') as file:
                    file.write(resp.content)

                if not value['whlify']:
                    return resp.content

                build_whl(sdistpath, localpath)

            data = b''
            with open(localpath, 'rb') as file:
                data = b''
                while True:
                    content = file.read(2 << 16)
                    if not content:
                        break
                    data += content
            return data
dataset/ETHPy150Open mardiros/pyshop/pyshop/helpers/download.py/ReleaseFileRenderer.__call__/original