following question
I do have a python script working and doing HTTP requests. Sometimes I get several errors like the http 400. Now I want to log those and interrupt the script from stop working.
import logging
date = .strftime().....
try:
script X
except:
error = urllib2.HTTPError
errorcode = error.code
file = open ("error.txt",'r+')
file.write("Error Code: %s, date \n", errorcode)
file.close()
pass
Is that right? Or did I something wrong. Should I use an If for the HTTP error?
Will this prevent the script from stopping while getting an error -> pass
Thank You!