def session ( self ) : self . _session = requests . session ( ) yield self . _session . close ( ) self . _session = None
python requests session pool
A context manager for this client s session .
def session(self):
        """A context manager for this client's session.

        This function closes the current session when this client goes out of
        scope.
        """
        self._session = requests.session()
        yield
        self._session.close()
        self._session = None