Which RPC module should be used to implement RCP in Python and the ability to change the connection method later?

I need to implement some RPC from Python to Python, but the connection methods are pretty limited for security reasons.

Currently it seems that I can connect using SSH and run a single python script on the remote system.

This may change in the future, when we may have to connect using something else, perhaps telnet , so I would like the solution to work using different protocols.

Another potential limitation concerns the version of Python, it should work with Python 2.5-2.7, even if the client and server work with different versions.

What should I use, please offer only if you had a successful experience, otherwise I can google too;)

0
source share
3 answers

I would say that the easiest way to pass two different python processes in your case is: pyro3 . I recently used pyro4 in a small project, and it was very effective to let me focus on the information I wanted to send / receive, rather than in a way to correctly encode / decode it.

I recommend you use v3 because v4 is not tested on python 2.5 according to the tox.ini file in the sources, so you may have problems.

As for networks, this library itself takes care of the sockets themselves, so there is no explicit support for telnet or ssh (although using paramiko on the TODO list). Hene, you probably have to rely on ssh tunnels, like this one.

+1
source

As a partial solution for python 2.6+, you can look at Versile Python (currently under development), we just added support for the reactor (a platform is required that allows select.select in pipe file descriptors, i.e. not Windows). This allows you to bind ORB to VPy through pipes or stdin / stdout. See recipe for an example of how it can be used with ssh.

Versile Python requires python 2.6+ or 3.x, unfortunately, does not work with 2.5.

0
source

Spyne supports pluggable protocols and transports, but it does not yet support SSH (or any other socket-like transport). This is a stable but completely new project - especially the client logic needs serious work.

As for your initial question, among those familiar with serializers (basically what you see on the spyne website), MessagePack is the most suitable for working with streaming transport, since it supports a file-like-object iterator (also known as streaming deserialization).

0
source

Source: https://habr.com/ru/post/1385332/


All Articles