I do a lookup on internet using CURL. I automated this using a python script to take an IP as an argument and further run CURL using that.

I tried the following:

maxm = os.system('curl -u  "Username : Password " %s' %url)

But still the output gets displayed on terminal and not as value for variable maxm.

I even tried subprocess.Popen. But that dint work though.

Seeking help to resolve this.

Regards Richa

1

There are 1 best solutions below

1
On BEST ANSWER

You could use subprocess.PIPE, but the easiest way is to use subprocess.check_output

import subprocess

maxm = subprocess.check_output('curl -u  "Username : Password " %s' % url)