Need help running external program
Leif B. Kristensen
abuse at solumslekt.org
Sun Feb 27 13:17:34 EST 2005
I'm using wget from Python to get extactly one line from a reports page.
I made this function that works for me:
def wgetline(exp): # see Python Cookbook p. 228
print "Getting result from server ..."
command = 'wget -q -O - \
http://www.foobar.com/report.pl\?UserID=xxx\&UserPW=xxx \
| grep ' + exp
child = os.popen(command)
data = child.read()
return data
I had to escape the ? and & in the url, or the CGI script at the other
end would refuse to cooperate with "Invalid UserID or UserPW".
--
Leif Biberg Kristensen
More information about the Python-list
mailing list