Created
October 15, 2020 13:20
-
-
Save nicksspirit/8eb26062ef833a6646268259cd361ad9 to your computer and use it in GitHub Desktop.
Decorator to run an async function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_async(fn): | |
@wraps(fn) | |
def fn_wrapped(*args, **kwargs): | |
return asyncio.run(fn(*args, **kwargs)) | |
return fn_wrapped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment