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版)
网络
309
Marshmallow
Pydantic
,该包用到了类型提示,要求
Python
版本最低为
Python 3.6
TypeSystem
这些工具通常与
We
b
服务器一起使用,确保通过
HTTP
传输的字节以正确的结构接受进一
步处理。
17.8
远程过程调用
远程过程调用(
remote procedure call
RPC
)看起来就像普通的函数,但是在网络上的远
程机器中执行的。不需要使用在
URL
HTTP
请求主体内编码的参数调用
RESTful
API
可以在自己的机器上调用
RPC
函数。我们的本地机器负责:
将函数参数序列化为字节;
将经过编码的字节发送至远程机器。
远程机器负责:
接收经过编码的请求字节;
将字节反序列化为数据结构;
使用解码后的数据查找并调用服务函数;
编码函数执行结果;
将编码后的字节返回给调用者。
最后,本地机器负责:
将返回的字节解码为结果。
RPC
是一种流行的技术
,有多种实现方式。在服务器端,启动服务器程序,使用某些字节
传输和编码
/
解码方法与其连接
,定义一些服务函数,对外宣布
RPC
已可用。客户端会连
接至服务器,通过
RPC
调用服务函数。
17.8.1 XML-RPC
标准库中包含了一种使用
XML
作为交换格式的
RPC
实现:
xmlrpc
。你在服务器中定义并
注册函数,客户端就像导入函数那样对其进行调用。先来研究一下文件
xmlrpc_server
.py
如例
17-1
1
所示。
17-11
xmlrpc_server.py
from xmlrpc.server ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

可编程网络自动化

可编程网络自动化

Jason Edelman, Scott S. Lowe, Matt Oswalt
Python实用技能学习指南

Python实用技能学习指南

Posts & Telecom Press, Robert Smallshire, Austin Bingham
量子计算机编程:从入门到实践

量子计算机编程:从入门到实践

Eric R. Johnston, Nicholas Harrigan, Mercedes Gimeno-Segovia
Python编程入门与实战

Python编程入门与实战

Posts & Telecom Press, Fabrizio Romano

Publisher Resources

ISBN: 9787115586223