def read_config(cls, section, path=None): parser = ReadConfig(path) instance = cls.__new__(cls) parser.update_attr(instance, section) setattr(instance, 'login_status', False) setattr(instance, 'session', requests.Session()) if hasattr(instance, 'host') and hasattr(instance, 'login_endpoint'): setattr( instance, 'login_url', urljoin(getattr(instance, 'host'), getattr(instance, 'login_endpoint'))) return instance
def read_config(cls, section, path=None): instance = cls.__new__(cls) parser = ReadConfig(path) parser.update_attr(instance, section) return instance