aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-04-08 21:16:30 -0400
committerRapptz <[email protected]>2016-04-08 21:16:30 -0400
commit222a89a6530316822ea9670b728acb79e686fcbe (patch)
treec981d11ba949de7232503d862e781b07bc5d0037
parentAdd support for token login (for bots) (diff)
downloaddiscord.py-222a89a6530316822ea9670b728acb79e686fcbe.tar.xz
discord.py-222a89a6530316822ea9670b728acb79e686fcbe.zip
Fix unclosed response and document token login a bit better.
-rw-r--r--discord/client.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/discord/client.py b/discord/client.py
index 720d887b..0d4542c9 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -450,9 +450,10 @@ class Client:
Parameters
----------
email : str
- The email used to login.
+ The email used to login. The string 'token' if using
+ the Bot OAuth2 Token flow.
password : str
- The password used to login.
+ The password or token used to login.
Raises
------
@@ -469,10 +470,10 @@ class Client:
self.token = password
self.headers['authorization'] = 'Bot {}'.format(self.token)
resp = yield from self.session.get(endpoints.ME, headers=self.headers)
+ yield from resp.release()
log.debug(request_logging_format.format(method='GET', response=resp))
if resp.status != 200:
- yield from resp.release()
if resp.status == 400:
raise LoginFailure('Improper token has been passed.')
else: