Release connection when error occurs during login.
This commit is contained in:
parent
037d3ab08a
commit
cf56ddfe4c
@ -625,9 +625,11 @@ class Client:
|
|||||||
data = utils.to_json(payload)
|
data = utils.to_json(payload)
|
||||||
resp = yield from aiohttp.post(endpoints.LOGIN, data=data, headers=self.headers, loop=self.loop)
|
resp = yield from aiohttp.post(endpoints.LOGIN, data=data, headers=self.headers, loop=self.loop)
|
||||||
log.debug(request_logging_format.format(method='POST', response=resp))
|
log.debug(request_logging_format.format(method='POST', response=resp))
|
||||||
|
if resp.status != 200:
|
||||||
|
yield from resp.release()
|
||||||
if resp.status == 400:
|
if resp.status == 400:
|
||||||
raise LoginFailure('Improper credentials have been passed.')
|
raise LoginFailure('Improper credentials have been passed.')
|
||||||
elif resp.status != 200:
|
else:
|
||||||
raise HTTPException(resp, None)
|
raise HTTPException(resp, None)
|
||||||
|
|
||||||
log.info('logging in returned status code {}'.format(resp.status))
|
log.info('logging in returned status code {}'.format(resp.status))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user