try:
conn = urllib2.urlopen
.. do_something ..
conn.close()
except Exception as ex:
raise ex
It's great to think about closing the connection, and also to handle exceptions.
In this example, however, except simply raises the original exception, it doesn't add anything.
If .. do_something .. fails, close() is not called.
ScanClient has a few sections like this:
It's great to think about closing the connection, and also to handle exceptions. In this example, however,
except
simply raises the original exception, it doesn't add anything. If.. do_something ..
fails,close()
is not called.Better: