def close(self):
"""Closes the connection and cleans up."""
# Close SFTP Connection.
if self._sftp_live:
self._sftp.close()
self._sftp_live = False
# Close the SSH Transport.
if self._transport:
self._transport.close()
self._transport = None
# clean up any loggers
if self._cnopts.log:
# if handlers are active they hang around until the app exits
# this closes and removes the handlers if in use at close
import logging
lgr = logging.getLogger("paramiko")
if lgr:
lgr.handlers = []
评论列表
文章目录