def __init__(self, _reactor, id, secret, file='./storage/config.bsv', port=8080, agent='slate/1 (dAmnViper 2)', option=None, state=None, stdout=None, stddebug=None, cache='./storage/api.cache'): def default_write(msg, *args): pass self.stdout = stdout or default_write self._debug = stddebug or default_write self.d = None self.file = file self.cachef = cache if not os.path.exists('./storage'): os.mkdir('./storage', 0o755) self.write('** Welcome to the configuration file!') self.data = Settings(self.file) self.api = APIClient(_reactor, id, secret, self.data.api.code, self.data.api.token, agent) self.port = port self.state = state self._reactor = reactor if option is None or not self.data.api.username: self.run_all('http://localhost:{0}'.format(port)) else: self.menu()