做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

PythonXMLRPC服務(wù)器端和客戶端實(shí)例

來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 14:40:26
文檔

PythonXMLRPC服務(wù)器端和客戶端實(shí)例

PythonXMLRPC服務(wù)器端和客戶端實(shí)例:一、遠(yuǎn)程過(guò)程調(diào)用RPC XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a transport. With it, a client can call methods with parameters on a remote server (the
推薦度:
導(dǎo)讀PythonXMLRPC服務(wù)器端和客戶端實(shí)例:一、遠(yuǎn)程過(guò)程調(diào)用RPC XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a transport. With it, a client can call methods with parameters on a remote server (the
一、遠(yuǎn)程過(guò)程調(diào)用RPC

XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a transport. With it, a client can call methods with parameters on a remote server (the server is named by a URI) and get back structured data. This module supports writing XML-RPC client code; it handles all the details of translating between conformable Python objects and XML on the wire.

簡(jiǎn)單地,client可以調(diào)用server上提供的方法,然后得到執(zhí)行的結(jié)果。類似與webservice。

推薦查看xmlprc的源文件:C:\Python31\Lib\xmlrpc

二、實(shí)例

1) Server

代碼如下:

from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler

def div(x,y):
return x - y

class Math:
def _listMethods(self):
# this method must be present for system.listMethods
# to work
return ['add', 'pow']
def _methodHelp(self, method):
# this method must be present for system.methodHelp
# to work
if method == 'add':
return "add(2,3) => 5"
elif method == 'pow':
return "pow(x, y[, z]) => number"
else:
# By convention, return empty
# string if no help is available
return ""
def _dispatch(self, method, params):
if method == 'pow':
return pow(*params)
elif method == 'add':
return params[0] + params[1]
else:
raise 'bad method'

server = SimpleXMLRPCServer(("localhost", 8000))
server.register_introspection_functions()
server.register_function(div,"div")
server.register_function(lambda x,y: x*y, 'multiply')
server.register_instance(Math())
server.serve_forever()

2)client

代碼如下:

import xmlrpc.client

s = xmlrpc.client.ServerProxy('http://localhost:8000')

print(s.system.listMethods())

print(s.pow(2,3)) # Returns 28
print(s.add(2,3)) # Returns 5
print(s.div(3,2)) # Returns 1
print(s.multiply(4,5)) # Returns 20

3)result

聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

PythonXMLRPC服務(wù)器端和客戶端實(shí)例

PythonXMLRPC服務(wù)器端和客戶端實(shí)例:一、遠(yuǎn)程過(guò)程調(diào)用RPC XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a transport. With it, a client can call methods with parameters on a remote server (the
推薦度:
標(biāo)簽: 客戶端 實(shí)例 xml
  • 熱門焦點(diǎn)

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 乐平市| 凤台县| 房山区| 临湘市| 三门县| 利津县| 威信县| 赤峰市| 莲花县| 仙桃市| 普兰店市| 崇州市| 西乡县| 山西省| 西安市| 滨海县| 斗六市| 蒲江县| 宁海县| 建昌县| 玛纳斯县| 石家庄市| 吉隆县| 内乡县| 阿城市| 高邮市| 荣昌县| 周宁县| 鹿泉市| 陆良县| 新干县| 抚宁县| 都江堰市| 安福县| 洛南县| 柳江县| 吕梁市| 水城县| 遵化市| 汉寿县| 景泰县|