title: Return results from asyncio.get_event_loop
body: <p>I'm new to using the asyncio module.  I have the following code that is querying a service to return IDs.  How do I set a variable to return the results from the 'findIntersectingFeatures' function?  </p>
  
  <p>Also, how can I have the print statements execute after run_in_executor has finished.  They are currently printing immediately after the first iteration.</p>
  
  <pre><code>import json, requests, time
  import asyncio
  
  startTime = time.clock()
  
  out_json = "UML10kmbuffer.json"
  
  intersections = []
  
  def findIntersectingFeatures(coordinate):
  
      coordinates = '{"rings":' + str(coordinate) + '}'
      forestCoverURL = 'http://server1.ags.com/server/rest/services/Forest_Cover/MapServer/0/query'
      params = {'f': 'json', 'where': "1=1", 'outFields': '*', 'geometry': coordinates, 'geometryType': 'esriGeometryPolygon', 'returnIdsOnly': 'true'}
      r = requests.post(forestCoverURL, data = params, verify=False)
      response = json.loads(r.content)
  
      if response['objectIds'] != None:
          intersections.append(response['objectIds'])
  
      return intersections
  
  
  with open(out_json, "r") as f_in:
      for line in f_in:
          json_res = json.loads(line)
  
  coordinates = []
  
  # Get features
  feat_json = json_res["features"]
  for item in feat_json:
      coordinates.append(item["geometry"]["rings"])
  
  loop = asyncio.get_event_loop()
  
  for coordinate in coordinates:
      loop.run_in_executor(None, findIntersectingFeatures, coordinate)
  
  
  print("Intersecting Features:  " + str(intersections))
  
  endTime = time.clock()
  elapsedTime =(endTime - startTime) / 60
  print("Elapsed Time: " + str(elapsedTime))
  </code></pre>