[Tutor] Passing HTTP commands through Telnet using Python for web site testing?

Adisegna adisegna at gmail.com
Thu Nov 17 05:13:02 CET 2005


So far this is what I have come up with doing some research.

import urllib
for line in urllib.urlopen('http://mywebsit.com/folder/folder/test.asp'):
if '400 Bad Request' in line:

text_file = open("mysite.log", "a")
text_file.writelines(line)
text_file.writelines("\n")
text_file.close()

This writes the to a new line each time the script is run. Now I have to
figure out an "if then else" to write the other possible error codes and
appending a timestamp followed by a space each time it runs.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051116/4e586720/attachment.html


More information about the Tutor mailing list