title: Async call method with Flask
body: <p>I'm trying to call a blocking function through a Flask method but it take several second, so I was thinking I could do some async call to speed things up but it doesn't work as expected.
  Apparently with asyncio I can't just launch a coroutine in background and don't wait for the end of the execution, maybe I need to use thread? Or use grequest as my blocking function is using request...</p>
  
  <p>Here's my code so far:</p>
  
  <pre><code>@app.route("/ressource", methods=["GET"])
  def get_ressource():
      do_stuff()
      return make_response("OK",200)  
  
  def do_stuff():
    # Some stuff
    fetch_ressource()
  
  
  async def fetch_ressource():
      return await blocking_function()
  
  
  def blocking_function():
    # Take 2-3 seconds
    result = request.get('path/to/remote/ressource')
    put_in_database(result)
  </code></pre>
  
  <p>I heard about Celeri but it seems a little overkill for only one function.</p>