Questions tagged [xmlrpclib]

xmlrpclib is the Python standard library module for transparently handling XML Remote Procedure Call. (Available since v2.2)

xmlrpclib is the Python standard library module for handling XML Remote Procedure Call. It has been available since Python 2.2, and is capable of sending the following types of data:

  • Booleans
  • Numbers
  • Strings
  • Arrays
  • Dicts
  • Dates
  • Binary data

The library's main class, ServerProxy, transparently calls its methods across a network, without having to use any special syntax. For example,

proxy = xmlrpclib.ServerProxy("http://www.example.com/rpc-example")
x = proxy.stdev([1,2,3,4,5])

will, behind the scenes, do this:

  1. Transmit a call to the stdev method (along with arguments, changed into XML RPC format) across the network, to the XML RPC server at "http://www.example.com/rpc-example".

  2. The server will read the command respond with the results of the call.

  3. The proxy object will read the results.

  4. The results will be cast from XML RPC format into a native Python object, and returned.

The Python documentation site hosts the xmlrpclib documentation.

149 questions
18
votes
2 answers

How to install xmlrpclib in python 3.4?

When I am trying to install xmlrpclib, I am getting following error in python version 3.4 Downloading/unpacking xmlrpclib Could not find any downloads that satisfy the requirement xmlrpclib Some externally hosted files were ignored (use…
James
  • 347
  • 1
  • 4
  • 13
15
votes
5 answers

Using **kwargs with SimpleXMLRPCServer in python

I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this: server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT)) service =…
Staale
  • 27,254
  • 23
  • 66
  • 85
13
votes
4 answers

Use Python xmlrpclib with unix domain sockets?

I'm trying to interact with supervisord, and I'd like to talk with it over a unix socket (it's a shared hosting environment). What I've tried so far is: import xmlrpclib server =…
Marcin
  • 48,559
  • 18
  • 128
  • 201
12
votes
1 answer

Python's xmlrpc extremely slow: one second per call

I built an xml-rpc server in Python using SimpleXMLRPCServer, according to the example in the Python documentation. I'm calling it from a Python client on the same machine. The body of the server function executes very fast on its own. But I find…
JimB
  • 971
  • 8
  • 20
9
votes
1 answer

How to see traceback on xmlrpc server, not client?

I have simple xmlrpc server code: from SimpleXMLRPCServer import SimpleXMLRPCServer port = 9999 def func(): print 'Hi!' print x # error! print 'Bye!' if __name__ == '__main__': server = SimpleXMLRPCServer(("localhost", port)) …
Adam
  • 2,254
  • 3
  • 24
  • 42
9
votes
1 answer

python: httplib.CannotSendRequest when nesting threaded SimpleXMLRPCServers

I am intermittently receiving a httplib.CannotSendRequest exception when using a chain of SimpleXMLRPCServers that use the SocketServer.ThreadingMixin. What I mean by 'chain' is the following: I have a client script which uses xmlrpclib to call a…
8
votes
1 answer

No module name 'xmlrpclib' when using Electrum from Command line

I just installed a bitcoin wallet from command line from Electrum.org heres how i installed it in my user account directory .. /home/user/... sudo pip3 install https://download.electrum.org/2.8.2/Electrum-2.8.2.tar.gz and it installed with no…
Benji Weiss
  • 406
  • 2
  • 6
  • 19
6
votes
2 answers

Multithreading problems with xmlrpclib.ServerProxy under python 2.7

I have an application which instantiates an xmlrpclib.ServerProxy once, and then passes it to several threads (web application requests), which all perform XML/RPC calls simultaneously. This works well with python 2.6. With python 2.7, we're getting…
sudoremo
  • 2,274
  • 2
  • 22
  • 39
5
votes
1 answer

Why would an XML-RPC API endpoint randomly throw a ProtocolError -1?

We have built an extensive middleware system around Magento's XML-RPC API. We've wrapped the endpoint with Python and are doing a lot of multicalls. At a seemingly random interval, the API responds with ProtocolError for…
5
votes
1 answer

Safe way to connect to RPC server

This question is related to How do we handle Python xmlrpclib Connection Refused? When I try to use the following code, with my RPC server down, _get_rpc() returns False and I'm good to go. However if the server is running, it fails with unknown…
Anthony Hiscox
  • 435
  • 8
  • 17
5
votes
1 answer

How do we handle Python xmlrpclib Connection Refused?

I don't know what the heck I'm doing wrong here, I wrote have an RPC client trying to connect to a non-existent server, and I'm trying to handle the exception that is thrown, but no matter what I try I can't figure out how I'm supposed to handle…
Anthony Hiscox
  • 435
  • 8
  • 17
5
votes
1 answer

Can XML-RPC methods be called by name (as strings) in Python?

In python, calling XML-RPC methods involves invoking methods on a proxy object: from xmlrpclib import ServerProxy print ServerProxy('https://example.com/rpc').api.hello_there('John') In some other languages, like perl, you pass your method name as…
Wedgwood
  • 993
  • 9
  • 10
5
votes
2 answers

Python xmlrpclib changes datetime object to DateTime instance on transmit

Messages exchanged between a client and a server using the xmlrpclib using Python 2.6.x creates a type of 'instance' on server side instead of type 'datetime'. On the client side I create a new updateTime = datetime(year, month, day, hour, minute,…
falc410
  • 85
  • 1
  • 12
5
votes
2 answers

How can I transfer binary data over xmlrpc (python)?

As the name xmlrpc implies, this transfer protocol relies on XML to carry data, and cannot transfer binary data, or non-printable ASCII-characters (\n, \b, chr(2),...) [or can it?]. I would like to know if there is a way to transfer a character…
Alex
  • 41,580
  • 88
  • 260
  • 469
4
votes
1 answer

xmlrpclib, wsapi4plone - check username and password

Here is one of my functions: def connect(): c = xmlrpclib.ServerProxy('http://username:password@host', allow_none=True, ) return c How do I check if the username and password are correct in this method before…
BPm
  • 2,924
  • 11
  • 33
  • 51
1
2 3
9 10