MCPcopy
hub / github.com/prompt-toolkit/ptpython / main

Function main

examples/asyncio-ssh-python-embed.py:36–53  ·  view source on GitHub ↗

Example that starts the REPL through an SSH server.

(port: int = 8222)

Source from the content-addressed store, hash-verified

34
35
36async def main(port: int = 8222) -> None:
37 """
38 Example that starts the REPL through an SSH server.
39 """
40 # Namespace exposed in the REPL.
41 environ = {"hello": "world"}
42
43 # Start SSH server.
44 def create_server() -> MySSHServer:
45 return MySSHServer(lambda: environ)
46
47 print(f"Listening on: {port}")
48 print(f'To connect, do "ssh localhost -p {port}"')
49
50 await asyncssh.create_server(
51 create_server, "", port, server_host_keys=["/etc/ssh/ssh_host_dsa_key"]
52 )
53 await asyncio.Future() # Wait forever.
54
55
56if __name__ == "__main__":

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected