Skip to content

Commit

Permalink
Merge pull request #8 from jnawk/dev
Browse files Browse the repository at this point in the history
Switch to async property
  • Loading branch information
jnawk authored Oct 7, 2020
2 parents 6ebf1a9 + df80b37 commit 915a826
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions quart_discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def revoke(self):
except KeyError:
pass

@property
async def authorized(self):
"""A boolean indicating whether current session has authorization token or not."""
async with await self._make_session() as discord_:
Expand Down
2 changes: 1 addition & 1 deletion quart_discord/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def requires_authorization(view):

@functools.wraps(view)
async def wrapper(*args, **kwargs):
if not await current_app.discord.authorized():
if not await current_app.discord.authorized:
raise exceptions.Unauthorized
return await view(*args, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@app.route("/")
async def index():
if not await discord.authorized():
if not await discord.authorized:
return f"""
{HYPERLINK.format(url_for(".login"), "Login")} <br />
{HYPERLINK.format(url_for(".login_with_data"), "Login with custom data")} <br />
Expand Down

0 comments on commit 915a826

Please sign in to comment.