Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle big response #249

Open
HanfordWu opened this issue Dec 28, 2022 · 1 comment
Open

Handle big response #249

HanfordWu opened this issue Dec 28, 2022 · 1 comment

Comments

@HanfordWu
Copy link

HanfordWu commented Dec 28, 2022

Hi team, I am running a command "show ip route bgp" and the response is too big for my client, do you have any good idea to chunk the response?
Thanks!

@dlyssenko
Copy link
Contributor

dlyssenko commented Feb 10, 2023

hi @HanfordWu,

currently pyeapi does not support chunked outputs. So, your option to handle very big outputs is to run the command redirecting it to a file, e.g., like this:

node.run_commands( 'show running-config >out.txt', encoding='text' )

and then read the file using underlying bash, here's just an example (there are multiple ways to achieve that):

node.run_commands( 'bash timeout 10 sed -n "50,60p" /mnt/flash/out.txt' )
[{'messages': ['!\nmanagement cli\n   command deprecated log\n!\nmanagement http-server\n   protocol http\n!\ninterface Ethernet1/1\n   speed forced 100gfull\n!\ninterface Ethernet2/1\n']}]

I'll mark this question as an enhancement request for future releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants