Skip to content

Instantly share code, notes, and snippets.

@Cheaterman
Created October 11, 2023 12:14
Show Gist options
  • Save Cheaterman/419948dabe929acd44aaecef68e71810 to your computer and use it in GitHub Desktop.
Save Cheaterman/419948dabe929acd44aaecef68e71810 to your computer and use it in GitHub Desktop.
main.py
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