Skip to content

Commit

Permalink
Add authorized property
Browse files Browse the repository at this point in the history
  • Loading branch information
weibeu committed May 20, 2019
1 parent ff6c6a7 commit 3c5d221
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion flask_discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ def callback(self):

def revoke(self):
"""This method clears current discord token, state and all session data from flask
session <http://flask.pocoo.org/docs/1.0/api/#flask.session>. Which means user will have
`session <http://flask.pocoo.org/docs/1.0/api/#flask.session>`_. Which means user will have
to go through discord authorization token grant flow again.
"""
for session_key in self.SESSION_KEYS:
session.pop(session_key)

@property
def authorized(self):
"""A boolean indicating whether current session has authorization token or not."""
return self._make_session().authorized

def fetch_user(self):
return models.User(self.get("/users/@me"))

Expand Down

0 comments on commit 3c5d221

Please sign in to comment.