Skip to content

Instantly share code, notes, and snippets.

@kennethreitz
Created March 18, 2018 11:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennethreitz/fab0f200f47cfa7926607043aed2b483 to your computer and use it in GitHub Desktop.
Save kennethreitz/fab0f200f47cfa7926607043aed2b483 to your computer and use it in GitHub Desktop.
import requests3
import trio
session = requests3.AsyncSession()
async def main():
async def request():
r = await session.get('http://127.0.0.1:8000/uuid', stream=False)
print(await r.json())
return r
for i in range(16):
async with trio.open_nursery() as nursery:
for i in range(512):
nursery.start_soon(request)
print('done!')
trio.run(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment