Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _login(self):
self._session.get(self._baseurl, timeout=self._timeout)
params = {'UserName': self._username,
'Password': self._password,
'RememberMe': 'false',
'timeOffset': 480}
resp = self._session.post(self._baseurl, params=params,
timeout=self._timeout)
if resp.status_code != 200:
# This never seems to happen currently, but
# I'll leave it here in case they start doing the
# right thing.
_LOG.error('Login as %s failed', self._username)
raise AuthError('Login failed')
self._default_url = resp.url
# Try a keepalive to see if we're _really_ logged in
try:
self.keepalive()
except SessionTimedOut:
_LOG.error('Login as %s failed', self._username)
raise AuthError('Login failed')
timeout=self._timeout)
if resp.status_code != 200:
# This never seems to happen currently, but
# I'll leave it here in case they start doing the
# right thing.
_LOG.error('Login as %s failed', self._username)
raise AuthError('Login failed')
self._default_url = resp.url
# Try a keepalive to see if we're _really_ logged in
try:
self.keepalive()
except SessionTimedOut:
_LOG.error('Login as %s failed', self._username)
raise AuthError('Login failed')