bot.py 文件源码

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

项目:yui 作者: item4 项目源码 文件源码
def call(
        self,
        method: str,
        data: Dict[str, str]=None
    ) -> Dict[str, Any]:
        """Call API methods."""

        async with aiohttp.ClientSession() as session:

            form = aiohttp.FormData(data or {})
            form.add_field('token', self.config.TOKEN)
            async with session.post(
                'https://slack.com/api/{}'.format(method),
                data=form
            ) as response:
                if response.status == 200:
                    return await response.json(loads=ujson.loads)
                else:
                    raise APICallError('fail to call {} with {}'.format(
                        method, data
                    ))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号