handlers.py 文件源码

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

项目:mygene.info 作者: biothings 项目源码 文件源码
def _pre_query_builder_GET_hook(self, options):
        if options.esqb_kwargs.include_tax_tree and 'all' not in options.esqb_kwargs.species:
            headers = {'content-type': 'application/x-www-form-urlencoded',
                        'user-agent': 'Python-requests_mygene.info/{} (gzip)'.format(requests.__version__)}

            res = requests.post(self.web_settings.INCLUDE_TAX_TREE_REDIRECT_TEMPLATE.format(
                ids=','.join(['{}'.format(sid) for sid in options.esqb_kwargs.species])), headers=headers)

            if res.status_code == requests.codes.ok:
                options['esqb_kwargs']['species'] = [str(x) for x in res.json()]
                #logging.debug('tax_tree species: {}'.format(options.esqb_kwargs.species))

        return options
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号