title: How to use aiohttp with ThreadPoolExecutor?
body: <p>I now have this code:</p>
  
  <pre><code>def parse_url(i):
      url = f"https://www.python.org/dev/peps/pep-{i}/"
      print(f"Started {str(i)}")
      r = requests.get(url)
      print(f"Ended {str(i)}")
      return r.content
  
  
  async def get_urls(executor):
      loop = asyncio.get_event_loop()
      tasks = [
          loop.run_in_executor(executor, parse_url, i)
          for i in range(8001, 8033)
      ]
      await asyncio.wait(tasks)
  
  
  if __name__ == '__main__':
      loop = asyncio.get_event_loop()
      executor = ThreadPoolExecutor(max_workers=2)
      s = time.perf_counter()
      loop.run_until_complete(
          get_urls(executor)
      )
      loop.close() 
  </code></pre>
  
  <p>Now the work is splitted between 2 threads, but each thread is doing request sequentially, what I want is standard async behaviour on each thread with aiohttp:</p>
  
  <ol>
  <li>Start a request</li>
  <li>While waiting for data open another request</li>
  <li>Receive result of request</li>
  </ol>
  
  <p>loop.run_in_executor does not allow coroutines to be passed as parameter, how can I achieve my desire?</p>