![]() ![]() ![]() listMethods ( ) This method returns a list of strings, one for each (non-system) method supported by the XML-RPC server. Servers that support the XML introspection API support some common methods grouped under the reserved system attribute: The RPC finishes by returning a value, which may be either returned data in a conformant type or a Fault or ProtocolError object indicating an error. the same method name can be overloaded with multiple argument signatures). Calling the method performs an RPC, dispatched by both name and argument signature (e.g. New code should use ServerProxy.Ī ServerProxy instance has a method corresponding to each remote procedure call accepted by the XML-RPC server. Server is retained as an alias for ServerProxy for backwards compatibility. If you have to pass arbitrary bytes via XML-RPC, use bytes or bytearray classes or the Binary wrapper class described below. However, it’s the caller’s responsibility to ensure that the string is free of characters that aren’t allowed in XML, such as the control characters with ASCII values between 0 and 31 (except, of course, tab, newline and carriage return) failing to do this will result in an XML-RPC request that isn’t well-formed XML. When passing strings, characters special to XML such as, and & will be automatically escaped. Note that the xmlrpc client module currently does not marshal instances of subclasses of built-in types. Both Fault and ProtocolError derive from a base class called Error. Method calls may also raise a special Fault instance, used to signal XML-RPC server errors, or ProtocolError used to signal an error in the HTTP/HTTPS transport layer. This is the full set of data types supported by XML-RPC. Passing is allowed only if allow_none is true. Returned type depends on the value of the use_builtin_types flag. Returned type depends on values of use_builtin_types and use_datetime flags.īinary, bytes or bytearray. Objects of user-defined classes can be passed in only their _dict_ attribute is transmitted.ĭateTime or datetime.datetime. Keys must be strings, values may be any conformable type. List or tuple containing conformable elements. that can be marshalled through XML), include the following (and except where noted, they are unmarshalled as the same Python type): If the remote server supports the introspection API, the proxy can also be used to query the remote server for the methods it supports (service discovery) and fetch other server-associated metadata. The returned instance is a proxy object with methods that can be used to invoke corresponding RPC calls on the remote server. If an HTTPS URL is provided, context may be ssl.SSLContext and configures the SSL settings of the underlying HTTPS connection. You only need to use this if the remote server requires a Basic Authentication user and password. The user:pass portion will be base64-encoded as an HTTP ‘Authorization’ header, and sent to the remote server as part of the connection process when invoking an XML-RPC method. The obsolete use_datetime flag is similar to use_builtin_types but it applies only to date/time values.Ĭhanged in version 3.8: The headers parameter was added.īoth the HTTP and HTTPS transports support the URL syntax extension for HTTP Basic Authentication: :port/path. The headers parameter is an optional sequence of HTTP headers to send with each request, expressed as a sequence of 2-tuples representing the header name and value. datetime.datetime, bytes and bytearray objects may be passed to calls. The use_builtin_types flag can be used to cause date/time values to be presented as datetime.datetime objects and binary data to be presented as bytes objects this flag is false by default. This is a commonly-used extension to the XML-RPC specification, but isn’t supported by all clients and servers see for a description. If allow_none is true, the Python constant None will be translated into XML the default behaviour is for None to raise a TypeError. The following parameters govern the use of the returned proxy instance. The optional fourth argument is a debugging flag. The optional third argument is an encoding, by default UTF-8. The optional second argument is a transport factory instance by default it is an internal SafeTransport instance for https: URLs and an internal HTTP Transport instance otherwise. The required first argument is a URI (Uniform Resource Indicator), and will normally be the URL of the server. ServerProxy ( uri, transport = None, encoding = None, verbose = False, allow_none = False, use_datetime = False, use_builtin_types = False, *, headers = (), context = None )Ī ServerProxy instance is an object that manages communication with a remote XML-RPC server. Changed in version 3.5: For HTTPS URIs, xmlrpc.client now performs all the necessary certificate and hostname checks by default.Ĭlass xmlrpc.client. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |