title: How to async await flask endpoint from python function
body: <p>I have a class that contains a function that I would like to be able to invoke by invoking a flask-resful endpoint. Is there a way to define an asynchronous function that would await/subscribe to this endpoint to be called? I can make changes to the flask app (but can't switch to SocketIO) as well if required or write some sort of async requests function. I can only work with the base Anaconda 3.7 library and I don't have any additional message brokers installed or available.</p>
  <pre class="lang-py prettyprint-override"><code>class DaemonProcess:
      def __init__(self):
          pass
  
      async def await_signal():
           signal = await http://ip123/signal
           self.(process_signal)  # do stuff with signal
  
  </code></pre>
  <p>For context, this isn't the main objective of the process. I simply want to be able to use this to tell my process remotely or via UI to shut down worker processes either gracefully or forcefully. The only other idea I came up with is pinging a database table repeatedly to see if a signal has been inserted, but time is of the essence and would require pinging at too short of intervals in my opinion and an asynchronous approach would be favored. The database would be SQLite3 and it doesn't appear to support update_hook callbacks.</p>