jsonrpc.py 文件源码

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

项目:Polyglot 作者: UniversalDevicesInc 项目源码 文件源码
def send_request(self, method_name, is_notification, params):
        """Issue the HTTP request to the server and return the method result (if not a notification)"""
        request_body = self.serialize(method_name, params, is_notification)
        try:
            response = self.request(data=request_body)
        except requests.RequestException as requests_exception:
            raise TransportError('Error calling method %r' % method_name, requests_exception)

        if response.status_code != requests.codes.ok:
            raise TransportError(response.status_code)

        if not is_notification:
            try:
                parsed = response.json()
            except ValueError as value_error:
                raise TransportError('Cannot deserialize response body', value_error)

            return self.parse_result(parsed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号