Fix exception when handling login failure
Logging in with an invalid token would throw a TypeError due to improper passing of arguments to HTTPClient._token. Fix by properly passing the keyword only bot argument.
This commit is contained in:
		| @@ -189,13 +189,13 @@ class HTTPClient: | |||||||
|  |  | ||||||
|     @asyncio.coroutine |     @asyncio.coroutine | ||||||
|     def static_login(self, token, *, bot): |     def static_login(self, token, *, bot): | ||||||
|         old_state = (self.token, self.bot_token) |         old_token, old_bot = self.token, self.bot_token | ||||||
|         self._token(token, bot=bot) |         self._token(token, bot=bot) | ||||||
|  |  | ||||||
|         try: |         try: | ||||||
|             data = yield from self.get(self.ME) |             data = yield from self.get(self.ME) | ||||||
|         except HTTPException as e: |         except HTTPException as e: | ||||||
|             self._token(*old_state) |             self._token(old_token, bot=old_bot) | ||||||
|             if e.response.status == 401: |             if e.response.status == 401: | ||||||
|                 raise LoginFailure('Improper token has been passed.') from e |                 raise LoginFailure('Improper token has been passed.') from e | ||||||
|             raise e |             raise e | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user