def _reset_session(self):
''' Get a new request session and try logging into the current
CVP node. If the login succeeded None will be returned and
self.session will be valid. If the login failed then an
exception error will be returned and self.session will
be set to None.
'''
self.session = requests.Session()
error = None
try:
self._login()
except (ConnectionError, CvpApiError, CvpRequestError,
CvpSessionLogOutError, HTTPError, ReadTimeout, Timeout,
TooManyRedirects) as error:
self.log.error(error)
# Any error that occurs during login is a good reason not to use
# this CVP node.
self.session = None
return error
评论列表
文章目录