# Module `src.httpapi.fdsafehandler`

Expand source code

    from gevent.pywsgi import WSGIServer, WSGIHandler
    from gevent import Timeout
    class FDSafeHandler(WSGIHandler):
        '''Our WSGI handler. Doesn't do much non-default except timeouts'''
        def handle(self):
            self.timeout = Timeout(120, Exception)
            self.timeout.start()
            try:
                WSGIHandler.handle(self)
            except Timeout as ex:
                if ex is self.timeout:
                    pass
                else:
                    raise

## Classes

`class FDSafeHandler (sock, address, server, rfile=None)`

  Our WSGI handler. Doesn't do much non-default except timeouts

  Expand source code

      class FDSafeHandler(WSGIHandler):
          '''Our WSGI handler. Doesn't do much non-default except timeouts'''
          def handle(self):
              self.timeout = Timeout(120, Exception)
              self.timeout.start()
              try:
                  WSGIHandler.handle(self)
              except Timeout as ex:
                  if ex is self.timeout:
                      pass
                  else:
                      raise

  ### Ancestors

  - gevent.pywsgi.WSGIHandler

  ### Methods

  `def handle(self)`

    The main request handling method, called by the server.

    This method runs a request handling loop, calling :meth:`handle_one_request` until all requests on the connection have been handled (that is, it implements keep-alive).

    Expand source code

        def handle(self):
            self.timeout = Timeout(120, Exception)
            self.timeout.start()
            try:
                WSGIHandler.handle(self)
            except Timeout as ex:
                if ex is self.timeout:
                    pass
                else:
                    raise