Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1.  
  2. async def get(url):
  3.     #...
  4.     response = await aiohttp.request('get', url)
  5.  
  6.  
  7. # вызывается из:
  8. async def fetch():
  9.     #...
  10.     with (await asyncio.Semaphore(10)):
  11.         with aiohttp.Timeout(30):
  12.             data = await get('yoba.dot')
  13.  
  14. #которая, вызывается так
  15. async def main():
  16.     #...
  17.     results = await asyncio.gather(*[fetch(u) for u in request_data['urls']])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement