properly stop when credentials are invalid|
This commit is contained in:
parent
c6f3d1cacf
commit
fd4a4408d8
3 changed files with 8 additions and 7 deletions
|
@ -59,10 +59,10 @@ class Client:
|
|||
):
|
||||
self.host = host
|
||||
self.port = port
|
||||
|
||||
self.options = options or {
|
||||
"reconnect" : True,
|
||||
"rctime" : 5.0,
|
||||
|
||||
}
|
||||
|
||||
self.token = token
|
||||
|
|
|
@ -87,6 +87,7 @@ class Dispatcher:
|
|||
self._dispatching = False
|
||||
if block and self._writer and self._reader:
|
||||
await asyncio.gather(self._writer, self._reader)
|
||||
if self._up:
|
||||
if self._up.can_write_eof():
|
||||
self._up.write_eof()
|
||||
self._up.close()
|
||||
|
|
|
@ -102,7 +102,7 @@ class Token:
|
|||
async with sess.post(endpoint, headers=cls.HEADERS, data=json.dumps(data).encode('utf-8')) as res:
|
||||
data = await res.json(content_type=None)
|
||||
logging.info(f"Auth request | {data}")
|
||||
if res.status != 200:
|
||||
if res.status >= 400:
|
||||
raise AuthException(f"Action '{endpoint.rsplit('/',1)[1]}' did not succeed")
|
||||
return data
|
||||
|
||||
|
|
Loading…
Reference in a new issue