Python httplib2 Handling Exceptions
问题 I have this very simple code to check if a site is up or down. import httplib2 h = httplib2.Http() response, content = h.request("http://www.folksdhhkjd.com") if response.status == 200: print "Site is Up" else: print "Site is down" When I enter a valid URL then it properly prints Site is Up because the status is 200 as expected. But, when I enter an invalid URL, should it not print Site is down? Instead it prints an exception something like this Traceback (most recent call last): File "C: