用Python打印完整的HTTP/2grpc响应

2024-04-25 12:10:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个用Python编写的gRPC服务器,我正在寻找一种方法来打印它在收到请求后提供的完整HTTP/2响应。返回和接收请求下面的方法。在

@inject.params(storage='storage')
def getPerson(self, request,context=None, storage = None)
    logger.info('call of username {}'.format(
        request.username
    ))
    logger.info('Client Metadata {} '.format(
        context.invocation_metadata()
    ))

    response = mProto.Auth()
    response.value = 100
    logger.info('Client Metadata {} '.format(
        context.invocation_metadata()
    ))
    #some code
    response = storage.request(request.username, request.password)
    return response

Tags: 方法infoclientnoneformatgrpcresponserequest