Skip to Content
Python语言及其应用(第2版)
book

Python语言及其应用(第2版)

by Bill Lubanovic
March 2022
Intermediate to advanced
522 pages
13h 52m
Chinese
Posts & Telecom Press
Content preview from Python语言及其应用(第2版)
网络
313
安装
Python
部分:
$
pip install grpcio
$
pip install grpcio-tools
Python
客户端文档非常详尽,这里只作简单的介绍。另外还有一份单独的教程(“
A simplified
guide to gRPC in Python
),你可能会喜欢。
要使用
gRPC
,需要编写
.proto
文件来定义
service
及其
rpc
方法。
rpc
方法类似于函数定义(描述其参数和返回值类型),可以指定下列某种联网模式。
请求
响应(同步或异步)
请求
流式响应
流式请求
响应(同步或异步)
流式请求
流式响应
单个响应可以是阻塞的或异步的。流式响应可以被迭代。
接下来,运行
grpc_tools.protoc
程序来为客户端和服务器创建
Python
代码。
gRPC
负责
处理序列化和网络通信。你可以向客户端和服务器添加应用特定的代码。
gRPC
W
eb REST API
的顶层替代方案。它似乎比
REST
更适合于服务间的通信,而
REST
可能更适合于公共
API
17.8.6 twirp
twirp
类似于
gRPC
,但其声称要更简单。和
gRPC
一样,你负责定义
.proto
文件,
twirp
责生成
Python
代码来处理客户端和服务器。
17.9
远程管理工具
Salt
是用
Python
编写的。起初是为了实现远程执行,后来逐渐发展成为功能完善的系
统管理平台。
Salt
基于
ZeroMQ
,而非
SSH
,能够扩展到数以千计的服务器。
Puppet
Chef
都是流行的远程管理工具,与 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python编程入门与实战

Python编程入门与实战

Posts & Telecom Press, Fabrizio Romano
Python实用技能学习指南

Python实用技能学习指南

Posts & Telecom Press, Robert Smallshire, Austin Bingham
Python技术基础视频教程

Python技术基础视频教程

保罗·J·戴特尔
Python面向对象编程指南

Python面向对象编程指南

Posts & Telecom Press, Steven F. Lott

Publisher Resources

ISBN: 9787115586223