Advertisement
Guest User

Untitled

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