Adisegna wrote:
> 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()

You are counting on the HTTP status code being part of the body of the 
response. This will depend on the details of the server. Better is to look at 
the actual HTTP status. Here is an example of retrieving a page with urllib2 
and capturing HTTP status codes:
http://mail.python.org/pipermail/python-list/2003-July/175455.html

Kent

-- 
http://www.kentsjohnson.com

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to