Python httplib and broken tcp connection
1 answer
When connected, you get one of the following values:
http://docs.python.org/library/httplib.html#httplib.HTTPException
you can do something like this.
>>> import httplib
>>> conn = httplib.HTTPConnection("www.python.org")
>>> try:
>>> conn.request("GET", "/index.html")
>>> except Exception as e:
>>> #take action according to the error.
>>> print(type(e))
>>> r1 = conn.getresponse()
>>> print r1.status, r1.reason
Example taken from www.python.org and edited
+4
a source to share