-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update examples to python 3.7 and add some other minor improvements
- Loading branch information
Showing
41 changed files
with
134 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -46,6 +46,6 @@ async def run_client() -> None: | |
await chan.wait_closed() | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -37,6 +37,6 @@ async def run_client() -> None: | |
await chan.wait_closed() | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -40,6 +40,6 @@ async def run_client() -> None: | |
await chan.wait_closed() | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -64,6 +64,9 @@ def eof_received(self) -> bool: | |
def break_received(self, msec: int) -> bool: | ||
return self.eof_received() | ||
|
||
def soft_eof_received(self) -> None: | ||
self.eof_received() | ||
|
||
class MySSHServer(asyncssh.SSHServer): | ||
def session_requested(self) -> asyncssh.SSHServerSession: | ||
return MySSHServerSession() | ||
|
@@ -73,7 +76,7 @@ async def start_server() -> None: | |
server_host_keys=['ssh_host_key'], | ||
authorized_client_keys='ssh_user_ca') | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2016-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2016-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -76,7 +76,7 @@ async def start_server() -> None: | |
authorized_client_keys='ssh_user_ca', | ||
process_factory=ChatClient.handle_client) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -34,6 +34,6 @@ async def run_client() -> None: | |
file=sys.stderr) | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2016-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2016-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -40,7 +40,7 @@ async def start_server() -> None: | |
authorized_client_keys='ssh_user_ca', | ||
sftp_factory=MySFTPServer) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -44,6 +44,6 @@ async def run_client() -> None: | |
await chan.wait_closed() | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -52,7 +52,7 @@ async def start_server() -> None: | |
server_host_keys=['ssh_host_key'], | ||
authorized_client_keys='ssh_user_ca') | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -53,7 +53,7 @@ async def start_server() -> None: | |
authorized_client_keys='ssh_user_ca', | ||
process_factory=handle_client) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2016-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2016-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -45,4 +45,4 @@ async def run_multiple_clients() -> None: | |
|
||
print(75*'-') | ||
|
||
asyncio.get_event_loop().run_until_complete(run_multiple_clients()) | ||
asyncio.run(run_multiple_clients()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -45,6 +45,6 @@ async def run_client() -> None: | |
print('Listener couldn\'t be opened.', file=sys.stderr) | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -28,6 +28,6 @@ async def run_client() -> None: | |
await listener.wait_closed() | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -29,6 +29,6 @@ async def run_client() -> None: | |
await listener.wait_closed() | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -44,7 +44,7 @@ async def start_server() -> None: | |
server_host_keys=['ssh_host_key'], | ||
authorized_client_keys='ssh_user_ca') | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2016-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2016-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -31,6 +31,6 @@ async def run_client() -> None: | |
print(op, '=', result, end='') | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -53,7 +53,7 @@ async def start_server() -> None: | |
authorized_client_keys='ssh_user_ca', | ||
process_factory=handle_client) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -27,6 +27,6 @@ async def run_client() -> None: | |
await conn.run('tail -r', input='1\n2\n3\n', stdout='/tmp/stdout') | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -30,6 +30,6 @@ async def run_client() -> None: | |
print(remote_result.stdout, end='') | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -29,6 +29,6 @@ async def run_client() -> None: | |
print(proc2_result.stdout, end='') | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2017-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2017-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -43,7 +43,7 @@ async def start_server() -> None: | |
authorized_client_keys='ssh_user_ca', | ||
process_factory=handle_client) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop = asyncio.new_event_loop() | ||
|
||
try: | ||
loop.run_until_complete(start_server()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python3.6 | ||
#!/usr/bin/env python3.7 | ||
# | ||
# Copyright (c) 2013-2021 by Ron Frederick <[email protected]> and others. | ||
# Copyright (c) 2013-2024 by Ron Frederick <[email protected]> and others. | ||
# | ||
# This program and the accompanying materials are made available under | ||
# the terms of the Eclipse Public License v2.0 which accompanies this | ||
|
@@ -28,6 +28,6 @@ async def run_client() -> None: | |
await listener.wait_closed() | ||
|
||
try: | ||
asyncio.get_event_loop().run_until_complete(run_client()) | ||
asyncio.run(run_client()) | ||
except (OSError, asyncssh.Error) as exc: | ||
sys.exit('SSH connection failed: ' + str(exc)) |
Oops, something went wrong.