xmlrpc.server — 基本 XML-RPC 服务器

源代码: Lib/xmlrpc/server.py


The xmlrpc.server module provides a basic server framework for XML-RPC servers written in Python. Servers can either be free standing, using SimpleXMLRPCServer , or embedded in a CGI environment, using CGIXMLRPCRequestHandler .

警告

The xmlrpc.server module is not secure against maliciously constructed data. If you need to parse untrusted or unauthenticated data see XML vulnerabilities .

可用性 :非 WASI。

This module does not work or is not available on WebAssembly. See WebAssembly 平台 了解更多信息。

class xmlrpc.server. SimpleXMLRPCServer ( addr , requestHandler = SimpleXMLRPCRequestHandler , logRequests = True , allow_none = False , encoding = None , bind_and_activate = True , use_builtin_types = False )

Create a new server instance. This class provides methods for registration of functions that can be called by the XML-RPC protocol. The requestHandler parameter should be a factory for request handler instances; it defaults to SimpleXMLRPCRequestHandler addr and requestHandler parameters are passed to the socketserver.TCPServer constructor. If logRequests is true (the default), requests will be logged; setting this parameter to false will turn off logging. The allow_none and encoding 参数被传递给 xmlrpc.client and control the XML-RPC responses that will be returned from the server. The bind_and_activate parameter controls whether server_bind() and server_activate() are called immediately by the constructor; it defaults to true. Setting it to false allows code to manipulate the allow_reuse_address class variable before the address is bound. The use_builtin_types parameter is passed to the loads() function and controls which types are processed when date/times values or binary data are received; it defaults to false.

3.3 版改变: The use_builtin_types flag was added.