def __getattr__(self, name): orig = Remote.__getattr__(self, name) if not orig: raise AttributeError(name) def generalmethod(*args): ret = orig(self._session, *args) if name == "login": self._session = ret if name == "logout": self._session = None return ret generalmethod.func_name = name return generalmethod
def __init__(self, *args): Remote.__init__(self, *args) self._session = None