title: Which magic method is called when flask request is end?
body: <p>I want to execute some task when request is done and terminated.</p>
  <p>My flask architecture is below:</p>
  <pre><code>class Main():
  
      def __init__(self,req,**kwargs):
          super().__init__(req,**kwargs)
          self.name = request.json.get('name')
  
      def post(self):
          return self.name
  </code></pre>
  <p>When receiving a post request I return the name. After that logic, I want to delete <code>self</code>, the object of that main class. How do I do that?</p>
  <p>My first thought is appending <code>__delete__</code> magic method at main class.</p>