-
-
Save coldnight/b5114a570f148c7aa124e4da3fb362a8 to your computer and use it in GitHub Desktop.
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
@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