Skip to content

Instantly share code, notes, and snippets.

@coldnight coldnight/t.py
Last active Jul 22, 2016

Embed
What would you like to do?
@gen.croutine
def _proxy(method, *args, **kwargs):
try:
ret = yield method(*args, **kwargs)
except ErrorYouWantCatch:
# logging or something else
ret = None
raise gen.Return(ret)
@gen.coroutine
def get(self):
http_client = AsyncHTTPClient()
response1, response2 = yield [_proxy( http_client.fetch, url1),
_proxy( http_client.fetch, url2)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.