Here's what I need to do:
I need to copy files over the network. The files to be copied is in the one machine and I need to send it to the remote machines. It should be automated and it should be made using python. I am quite familiar with os.popen and subprocess.Popen of python. I could use this to copy the files, BUT, the problem is once I have run the one-liner command (like the one shown below)

scp  xxx@localhost:file1.txt yyy@]192.168.104.XXX:file2.txt

it will definitely ask for something like

Are you sure you want to connect (yes/no)?
Password :

And if im not mistaken., once I have sent this command (assuming that I code this in python)

conn.modules.os.popen("scp  xxx@localhost:file1.txt yyy@]192.168.104.XXX:file2.txt")

and followed by this command

conn.modules.os.popen("yes")

The output (and I'm quite sure that it would give me errors) would be the different comparing it to the output if I manually type it in in the terminal.
Do you know how to code this in python? Or could you tell me something (a command etc.) that would solve my problem
Note: I am using RPyC to connect to other remote machines and all machines are running on CentOS
per my experience, use sftp the first time will prompt user to accept host public key, such as 
The authenticity of host 'xxxx' can't be established.
 RSA key  fingerprint is xxxx. Are you sure you want to continue connecting
 (yes/no)?

once you input yes, the public key will be saved in ~/.ssh/known_hosts, and next time you will not get such prompt/alert.
To avoid this prompt/alert in batch script, you can use turn strict host check off use 

scp -Bqpo StrictHostKeyChecking=no 

but you are vulnerable to  man-in-the-middle attack.
you can also choose to connect to target server manually and save host public key before deploy your batch script.
How to automate the sending of files over the network using python?