zssdk3.py 文件源码

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

项目:Charlie 作者: nxintech 项目源码 文件源码
def poll(self, action, body):
        if not action.NEED_POLL:
            return raise_error(202, body)

        location = body['location']

        with async_timeout.timeout(self._polling_timeout):
            count = 0
            while True:
                status, body = await self._do_request('GET', location)
                if status in [200, 503]:
                    return {"value": json.loads(body)}

                count += 1
                await asyncio.sleep(self._polling_interval)

        # polling timeout
        return raise_error(500, "Location {} polling timeout, count: {}".format(location, count))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号