presto.py 文件源码

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

项目:prestornado 作者: jianingy 项目源码 文件源码
def poll(self):
        """Poll for and return the raw status data provided by the Presto REST API.

        :returns: dict -- JSON status information or ``None`` if the query is done
        :raises: ``ProgrammingError`` when no query has been started

        .. note::
            This is not a part of DB-API.
        """
        if self._state == self._STATE_NONE:
            raise ProgrammingError("No query yet")
        if self._nextUri is None:
            assert self._state == self._STATE_FINISHED, "Should be finished if nextUri is None"
            raise Return(None)
        request = HTTPRequest(self._nextUri)
        client = AsyncHTTPClient(max_clients=512)
        response = yield client.fetch(request)
        self._process_response(response)
        raise Return(json_decode(response.body))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号