client.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:kripodb 作者: 3D-e-Chem 项目源码 文件源码
def pharmacophores(self, fragment_ids):
        absent_identifiers = []
        pharmacophores = []
        for fragment_id in fragment_ids:
            url = self.base_url + '/fragments/{0}.phar'.format(fragment_id)
            try:
                response = requests.get(url)
                response.raise_for_status()
                pharmacophore = response.text
                pharmacophores.append(pharmacophore)
            except HTTPError as e:
                if e.response.status_code == 404:
                    pharmacophores.append(None)
                    absent_identifiers.append(fragment_id)
                else:
                    raise e
        if absent_identifiers:
            raise IncompletePharmacophores(absent_identifiers, pharmacophores)
        return pharmacophores
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号