requires_authorization now takes async views

This commit is contained in:
Philip Dowie
2020-08-16 16:39:24 +12:00
parent ea8bfc2eeb
commit 0118677665
2 changed files with 3 additions and 3 deletions

View File

@@ -14,4 +14,4 @@ __all__ = [
]
__version__ = "0.2.0"
__version__ = "0.2.1"

View File

@@ -43,9 +43,9 @@ def requires_authorization(view):
# TODO: Add support to validate scopes.
@functools.wraps(view)
def wrapper(*args, **kwargs):
async def wrapper(*args, **kwargs):
if not current_app.discord.authorized:
raise exceptions.Unauthorized
return view(*args, **kwargs)
return await view(*args, **kwargs)
return wrapper