在应用程序中嵌入远程Python shell

时间:2021-07-16 21:41:45

You can embed the IPython shell inside of your application so that it launches the shell in the foreground. Is there a way to embed a telnet server in a python app so that you can telnet to a certain port and launch a remote IPython shell?

您可以将IPython shell嵌入到应用程序中,以便在前台启动shell。有没有办法在python应用程序中嵌入telnet服务器,以便您可以telnet到某个端口并启动远程IPython shell?

Any tips for redirecting the input/output streams for IPython or how to hook it up to a telnet server library or recommendations for other libraries that could be used to implement this are much appreciated.

任何有关重定向IPython的输入/输出流或如何将其连接到telnet服务器库的提示或者可用于实现此目的的其他库的建议都非常感谢。

4 个解决方案

#1


3  

Python includes a telnet client, but not a telnet server. You can implement a telnet server using Twisted. Here's an example. As for hooking these things together, that's up to you.

Python包括一个telnet客户端,但不包括telnet服务器。您可以使用Twisted实现telnet服务器。这是一个例子。至于把这些东西挂在一起,这取决于你。

#2


1  

Use Twisted Manhole. Docs are a bit lacking, but it's easy enough to set up a telnet-based remote server and it comes with a GTK-based GUI.

使用扭曲的人孔。文档有点缺乏,但它很容易设置一个基于telnet的远程服务器,它配备了基于GTK的GUI。

#3


0  

I think you should base your server class on the SocketServer class from the standard library. You'll need to write a RequestHandler to read and echo input but a lot of the heavy lifting is already done for you.

我认为您应该将您的服务器类基于标准库中的SocketServer类。您需要编写一个RequestHandler来读取和回显输入,但是已经为您完成了许多繁重的工作。

You can use the ThreadingMixIn to make the server multi-threaded very easily.

您可以使用ThreadingMixIn轻松地使服务器成为多线程。

#4


0  

Try to use xmlrpc namespace

尝试使用xmlrpc命名空间

#1


3  

Python includes a telnet client, but not a telnet server. You can implement a telnet server using Twisted. Here's an example. As for hooking these things together, that's up to you.

Python包括一个telnet客户端,但不包括telnet服务器。您可以使用Twisted实现telnet服务器。这是一个例子。至于把这些东西挂在一起,这取决于你。

#2


1  

Use Twisted Manhole. Docs are a bit lacking, but it's easy enough to set up a telnet-based remote server and it comes with a GTK-based GUI.

使用扭曲的人孔。文档有点缺乏,但它很容易设置一个基于telnet的远程服务器,它配备了基于GTK的GUI。

#3


0  

I think you should base your server class on the SocketServer class from the standard library. You'll need to write a RequestHandler to read and echo input but a lot of the heavy lifting is already done for you.

我认为您应该将您的服务器类基于标准库中的SocketServer类。您需要编写一个RequestHandler来读取和回显输入,但是已经为您完成了许多繁重的工作。

You can use the ThreadingMixIn to make the server multi-threaded very easily.

您可以使用ThreadingMixIn轻松地使服务器成为多线程。

#4


0  

Try to use xmlrpc namespace

尝试使用xmlrpc命名空间