Aymen
Aymen

Reputation: 83

How to include wget command in python with server IP as a variable?

I tried the following code to download a file from the servers that have different IP addresses, but it doesn't work. How to include the server IP address in URL as a variable? Note: I include the iperf commands in the post as an example since it works fine.

I included the wget commands for the server and the client python file.

server.cmd("iperf -s > /dev/null &" )
server.cmd("python -m SimpleHTTPServer 8000  &")
client.cmd("iperf -c %s -t %d > /dev/null &" % (server.IP(), 1990))
client.cmd("wget  http://&server.IP()&:8000/DCN.py &")

I expect the client can download the DCN.py from the named IP server.

Upvotes: 0

Views: 337

Answers (1)

Balázs Kovacsics
Balázs Kovacsics

Reputation: 701

Why don't you just use a format string like in the iperf command?

client.cmd("wget http://%s:8000/DCN.py &" % server.IP())

Upvotes: 1

Related Questions