<p>I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients.  Security is also an issue - so secure login would be a plus.  I've been looking into XML-RPC, but it looks to be a pretty old (and possibly unused these days?) protocol.</p>

[{'answer_id': 64471, 'author': 'pobk', 'author_id': 7829, 'author_profile': 'https://Stackoverflow.com/users/7829', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://pyro.sf.net" rel="noreferrer">Pyro</a> (Python Remote Objects) is fairly clever if all your server/clients are going to be in Python. I use <a href="http://www.xmpp.org" rel="noreferrer">XMPP</a> alot though since I\'m communicating with hosts that are not always Python. XMPP lends itself to being extended fairly easily too.</p>\n\n<p>There is an excellent XMPP library for python called <a href="http://pyxmpp.jajcus.net" rel="noreferrer">PyXMPP</a> which is reasonably up to date and has no dependancy on Twisted.</p>\n'}, {'answer_id': 64487, 'author': 'maccullt', 'author_id': 4945, 'author_profile': 'https://Stackoverflow.com/users/4945', 'pm_score': 1, 'selected': False, 'text': '<p>I\'d use http and start with understanding what the Python <a href="http://docs.python.org/lib/asyncore-example.html" rel="nofollow noreferrer">library</a> offers. </p>\n\n<p>Then I\'d move onto the more industrial strength <a href="http://wiki.python.org/moin/Twisted-Examples" rel="nofollow noreferrer">Twisted</a> library.</p>\n'}, {'answer_id': 64489, 'author': 'Will Harris', 'author_id': 4702, 'author_profile': 'https://Stackoverflow.com/users/4702', 'pm_score': 2, 'selected': False, 'text': '<p><a href="http://www.ietf.org/rfc/rfc2616.txt" rel="nofollow noreferrer">HTTP</a> seems to suit your requirements and is very well supported in Python. </p>\n\n<p><a href="http://twistedmatrix.com/" rel="nofollow noreferrer">Twisted</a> is good for serious asynchronous network programming in Python, but it has a steep learning curve, so it might be worth using something simpler unless you know your system will need to handle a lot of concurrency.</p>\n\n<p>To start, I would suggest using <a href="http://www.python.org/doc/lib/module-urllib2.html" rel="nofollow noreferrer"><code>urllib</code></a> for the client and a <a href="http://code.google.com/p/modwsgi/" rel="nofollow noreferrer">WSGI service behind Apache</a> for the server. Apache can be set up to deal with HTTPS fairly simply.</p>\n'}, {'answer_id': 64572, 'author': 'Pierre-Jean Coudert', 'author_id': 8450, 'author_profile': 'https://Stackoverflow.com/users/8450', 'pm_score': -1, 'selected': False, 'text': '<p>In the RPC field, Json-RPC will bring a big performance improvement over xml-rpc: \n<a href="http://json-rpc.org/wiki/python-json-rpc" rel="nofollow noreferrer">http://json-rpc.org/wiki/python-json-rpc</a></p>\n'}, {'answer_id': 64690, 'author': 'Erik Forsberg', 'author_id': 8675, 'author_profile': 'https://Stackoverflow.com/users/8675', 'pm_score': 0, 'selected': False, 'text': '<p>XMLRPC is very simple to get started with, and at my previous job, we used it extensively for intra-node communication in a distributed system. As long as you keep track of the fact that the None value can\'t be easily transferred, it\'s dead easy to work with, and included in Python\'s standard library. </p>\n\n<p>Run it over https and add a username/password parameter to all calls, and you\'ll have simple security in place. Not sure about how easy it is to verify server certificate in Python, though.</p>\n\n<p>However, if you are transferring large amounts of data, the coding into XML might become a bottleneck, so using a <a href="http://sv.wikipedia.org/wiki/REST" rel="nofollow noreferrer">REST</a>-inspired architecture over https may be as good as xmlrpclib.</p>\n'}, {'answer_id': 76560, 'author': 'Glyph', 'author_id': 13564, 'author_profile': 'https://Stackoverflow.com/users/13564', 'pm_score': 3, 'selected': False, 'text': '<p>If you are looking to do file transfers, XMLRPC is likely a bad choice.  It will require that you encode all of your data as XML (and load it into memory).</p>\n\n<p>"Data requests" and "file transfers" sounds a lot like plain old HTTP to me, but your statement of the problem doesn\'t make your requirements clear.  What kind of information needs to be encoded in the request?  Would a URL like "<a href="http://yourserver.example.com/service/request?color=yellow&amp;flavor=banana" rel="nofollow noreferrer">http://yourserver.example.com/service/request?color=yellow&amp;flavor=banana</a>" be good enough?</p>\n\n<p>There are lots of HTTP clients and servers in Python, none of which are especially great, but all of which I\'m sure will get the job done for basic file transfers.  You can do security the "normal" web way, which is to use HTTPS and passwords, which will probably be sufficient.</p>\n\n<p>If you want two-way communication then HTTP falls down, and a protocol like Twisted\'s <a href="http://twistedmatrix.com/projects/core/documentation/howto/pb-intro.html" rel="nofollow noreferrer">perspective broker (PB)</a> or <a href="http://twistedmatrix.com/documents/8.1.0/api/twisted.protocols.amp.html" rel="nofollow noreferrer">asynchronous messaging protocol (AMP)</a> might suit you better.  These protocols are certainly well-supported by Twisted.</p>\n'}, {'answer_id': 256826, 'author': 'Michael ', 'author_id': 33427, 'author_profile': 'https://Stackoverflow.com/users/33427', 'pm_score': 2, 'selected': False, 'text': '<p>I suggest you look at 1. XMLRPC 2. JSONRPC 3. SOAP 4. REST/ATOM\nXMLRPC is a valid choice. Don\'t worry it is too old. That is not a problem. It is so simple that little needed changing since original specification. The pro is that in every programming langauge I know there is a library for a client to be written in. Certainly for python. I made it work with mod_python and had no problem at all.\nThe big problem with it is its verbosity. For simple values there is a lot of XML overhead. You can gzip it of cause, but then you loose some debugging ability with the tools like Fiddler.</p>\n\n<p>My personal preference is JSONRPC. It has all of the XMLRPC advantages and it is very compact. Further, Javascript clients can "eval" it so no parsing is necessary. Most of them are built for version 1.0 of the standard. I have seen diverse attempts to improve on it, called 1.1 1.2 and 2.0 but they are not built one on top of another and, to my knowledge, are not widely supported yet. 2.0 looks the best, but I would still stick with 1.0 for now (October 2008)</p>\n\n<p>Third candidate would be REST/ATOM. REST is a principle, and ATOM is how you convey bulk of data when it needs to for POST, PUT requests and GET responses.\nFor a very nice implementation of it, look at GData, Google\'s API. Real real nice.</p>\n\n<p>SOAP is old, and lots lots of libraries / langauges support it. IT is heeavy and complicated, but if your primary clients are .NET or Java, it might be worth the bother.\nVisual Studio would import your WSDL file and create a wrapper and to C# programmer it would look like local assembly indeed.</p>\n\n<p>The nice thing about all this, is that if you architect your solution right, existing libraries for Python would allow you support more then one with almost no overhead. XMLRPC and JSONRPC are especially good match.</p>\n\n<p>Regarding authentication. XMLRPC and JSONRPC don\'t bother defining one. It is independent thing from the serialization. So you can implement Basic Authentication, Digest Authentication or your own with any of those. I have seen couple of examples of client side Digest Authentication for python, but am yet to see the server based one. If you use Apache, you might not need one, using mod_auth_digest Apache module instead. This depens on the nature of your application</p>\n\n<p>Transport security. It is obvously SSL (HTTPS). I can\'t currently remember how XMLRPC deals with, but with JSONRPC implementation that I have it is trivial - you merely change http to https in your URLs to JSONRPC and it shall be going over SSL enabled transport.</p>\n'}, {'answer_id': 256833, 'author': 'MarkR', 'author_id': 13724, 'author_profile': 'https://Stackoverflow.com/users/13724', 'pm_score': 1, 'selected': False, 'text': "<p>There is no need to use HTTP (indeed, HTTP is not good for RPC in general in some respects), and no need to use a standards-based protocol if you're talking about a python client talking to a python server.</p>\n\n<p>Use a Python-specific RPC library such as Pyro, or what Twisted provides (Twisted.spread).</p>\n"}, {'answer_id': 257415, 'author': 'Dickon Reed', 'author_id': 22668, 'author_profile': 'https://Stackoverflow.com/users/22668', 'pm_score': 2, 'selected': False, 'text': '<p>SSH can be a good choice for file transfer and remote control, especially if you are concerned with secure login. Most Linux and Solaris servers will already run an SSH service for administration, so if your Python program use ssh then you don\'t need to open up any additional ports or services on remote machines. </p>\n\n<p><a href="http://www.openssh.com/" rel="nofollow noreferrer">OpenSSH</a> is the standard and portable SSH client and server, and can be used via subprocesses from Python. If you want more flexibility Twisted includes <a href="http://twistedmatrix.com/trac/wiki/TwistedConch" rel="nofollow noreferrer">Twisted Conch</a> which is a SSH client and server implementation which provides flexible programmable control of an SSH stack, on both Linux and Windows. I use both in production.</p>\n'}, {'answer_id': 280853, 'author': 'Phillip B Oldham', 'author_id': 30478, 'author_profile': 'https://Stackoverflow.com/users/30478', 'pm_score': 0, 'selected': False, 'text': '<p><a href="http://incubator.apache.org/thrift/" rel="nofollow noreferrer">Facebook\'s thrift</a> project may be a good answer. It uses a light-weight protocol to pass object around and allows you to use any language you wish. It may fall-down on security though as I believe there is none.</p>\n'}, {'answer_id': 292659, 'author': 'Jim Carroll', 'author_id': 35922, 'author_profile': 'https://Stackoverflow.com/users/35922', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://code.google.com/p/protobuf/" rel="noreferrer">ProtocolBuffers</a> was released by Google as a way of serializing data in a very compact efficient way.  They have support for C++, Java and Python.  I haven\'t used it yet, but looking at the source, there seem to be RPC clients and servers for each language.  </p>\n\n<p>I personally have used XML-RPC on several projects, and it always did exactly what I was hoping for.  I was usually going between C++, Java and Python.  I use libxmlrpc in Python often because it\'s easy to memorize and type interactively, but it is actually much slower than the alternative <a href="http://sourceforge.net/projects/py-xmlrpc/" rel="noreferrer">pyxmlrpc</a>.</p>\n\n<p>PyAMF is mostly for RPC with Flash clients, but it\'s a compact RPC format worth looking at too.</p>\n\n<p>When you have Python on both ends, I don\'t believe anything beats <a href="http://pyro.sourceforge.net/" rel="noreferrer">Pyro</a>  (Python Remote Objects.)  Pyro even has a "name server" that lets services announce their availability to a network.  Clients use the name server to find the services it needs no matter where they\'re active at a particular moment.  This gives you free redundancy, and the ability to move services from one machine to another without any downtime.</p>\n\n<p>For security, I\'d tunnel over SSH, or use TLS or SSL at the connection level.  Of course, all these options are essentially the same, they just have various difficulties of setup.</p>\n'}]
['https://Stackoverflow.com/questions/64426', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8585/']