Skip to content

Reading long output on device without datadump #306

Answered by denisbondar
Sciti asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, friends!

Thanks to @carlmontanari for providing a great example!

Unfortunately, the documentation, which is always very hard to write, is not completely clear for read_callback (and also a bit behind the code).

To make your example work more properly, inside the paginate_callback callback you need to add a new line to the buffer:

def paginate_callback(self, cls: GenericDriver, read_output: str) -> None:
    self.buf += read_output + "\n"

    cls.channel.write(channel_input=self.paginate_response, redacted=False)

Otherwise, the next line is added to the end of the "pagination hint".

My example of using pagination looks like this (I use my extra layer of drivers for ease of instanti…

Replies: 6 comments 21 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@denisbondar
Comment options

@Sciti
Comment options

@denisbondar
Comment options

@carlmontanari
Comment options

@Sciti
Comment options

Comment options

You must be logged in to vote
1 reply
@Sciti
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
11 replies
@carlmontanari
Comment options

@Sciti
Comment options

@carlmontanari
Comment options

@denisbondar
Comment options

Answer selected by carlmontanari
@carlmontanari
Comment options

@denisbondar
Comment options

@Sciti
Comment options

@denisbondar
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants