Created
October 11, 2023 12:14
-
-
Save Cheaterman/419948dabe929acd44aaecef68e71810 to your computer and use it in GitHub Desktop.
main.py
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
chunks = [ | |
'He', | |
'llo ', | |
', W', | |
'orl', | |
'd!\nA', | |
'nd h', | |
'ap', | |
'py ', | |
'Pyth', | |
'oning\n', | |
] | |
# class that pretends to be your libssh channel | |
class Channel: | |
def __init__(self): | |
self.data = iter(chunks) | |
def read(self): | |
try: | |
return self.data.__next__() | |
except StopIteration: | |
return '' | |
buffer = '' | |
channel = Channel() | |
while True: | |
data = channel.read() | |
print(repr(data)) | |
if not data: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment