I have the following code to post the remote URL back:
request = urllib2.Request('http://www.example.com', postBackData, { 'User-Agent' : 'My User Agent' }) try: response = urllib2.urlopen(request) except urllib2.HTTPError, e: checksLogger.error('HTTPError = ' + str(e.code)) except urllib2.URLError, e: checksLogger.error('URLError = ' + str(e.reason)) except httplib.HTTPException, e: checksLogger.error('HTTPException')
PostBackData is created using a dictionary encoded using urllib.urlencode. checkLogger is a logger using logging .
I had a problem when this code starts, when the remote server is turned off, and the code exits (this is on client servers, so I donβt know what the stack dump / error is at that moment). I assume this is because there is an exception and / or error that is not being handled. Could there be other exceptions that may be thrown that I do not handle above?
python
DavidM Mar 20 '09 at 12:56 2009-03-20 12:56
source share