How to work with interactive API in python

I am in a situation where I need to pass some texts to the generation request using the API (it seems to be a rather strange behavior for the API, this is the first time I came across this), as shown below:

kvm_cli = libvirt.open("qemu+ssh:// han@10.0.10.8 /system") 

then a request appears asking for the ssh password for 10.0.10.8 is: ( password for 10.0.10.8 is: , I need to manually enter it there to go and provide the kvm_cli object that I need.

I tried using the pexpect module to solve this problem, but for the OS command line instead of the API.

You can also work around this using ssh certification files, but this is not a favorable approach to authentication in our scenario.

Since our shell for the "open" method is not interactive, we can’t ask the user to enter a password, you guys thought how I can solve it?

+6
python libvirt
source share
1 answer

I am not a libvirt user, but I believe that the problem is not in the library, but in the connection method. It seems you are connecting via ssh, so you need to go through authentication.

I read the libvirt page in ArchWiki , and I think you could try:

+4
source share

All Articles