加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
grpc_patient.py 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
陈敏华 提交于 2020-06-19 10:27 . init
#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
# Author: Bary Chen
from concurrent import futures
import time
import grpc
from ui_grpc import test_pb2, test_pb2_grpc
class RemotePatientInfoServicer(test_pb2_grpc.RemotePatientInfoServicer):
def show_patient_info(self, request, context):
try:
# print(request.ID)
# print(request.FirstName)
# print(request.MiddleName)
# print(request.LastName)
# print(request.Gender)
# print(request.BirthDate)
# print(request.Address)
# print(request.Department)
# print(request.AutoNext)
pass
return test_pb2.SetPatientInfoReply(Success=True)
except Exception as e:
print(e)
if __name__ == '__main__':
# 多线程服务器
server = grpc.server(futures.ThreadPoolExecutor(max_workers=4))
service = RemotePatientInfoServicer()
test_pb2_grpc.add_RemotePatientInfoServicer_to_server(service, server)
server.add_insecure_port('127.0.0.1:55000')
server.start()
try:
print("running...")
time.sleep(2000)
except KeyboardInterrupt:
print("stopping...")
server.stop(0)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化