Created
October 5, 2017 23:46
-
-
Save palazzem/a7a53c06e9e270c9f71505de4752c8d5 to your computer and use it in GitHub Desktop.
pygotham_talk_handler.py
This file contains 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
class Handler(object): | |
async def handle_request(self, request): | |
# set the current context | |
ctx = {} | |
set_current_context(ctx) | |
ctx['username'] = request.get('username', 'Anonymous') | |
result = await retrieve_user_data() | |
return result | |
async def retrieve_user_data(self): | |
# do a long call | |
await asyncio.sleep(2) | |
ctx = get_current_context() | |
return ctx['username'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment