def main(): global question_queue # question_queue = fill_queue() # attribute, question = question_queue.get() for attribute, question in QUESTIONS: ask_question(attribute, question, SENDER_ID, USER_PROFILE) app.run(debug=True)
def main(): global question_queue # question_queue = fill_queue() # attribute, question = question_queue.get() for attribute, question in QUESTIONS: ask_question( attribute, question, SENDER_ID, USER_PROFILE ) app.run(debug=True)
def ask_all_questions(): project_name = utils.ask_question("name:") readme = utils.ask_yes_no_question("Do you want to initialise a README?") venv = utils.ask_yes_no_question("Initialise a virtual environment?") if venv: pytest = utils.ask_yes_no_question( "Do you want pytest to be installed?") else: pytest = False git = utils.ask_yes_no_question("Do you want to initialise a git repo?") if git: hooks = utils.ask_yes_no_question( "Do you want to initialise a git hooks?") else: hooks = False return { "name": project_name, "venv": venv, "pytest": pytest, "readme": readme, "git": git, "hooks": hooks }
def execute(self, hpk_api, args): max_confirm_error = 3 name = ask_question('New password name:') login = ask_question('Login:'******'Password:'******'password') while ask_question('Confirm password:'******'password') != password: if max_confirm_error == 0: print('Confirm password failed. Exit.') return print('Passwords do not match, please retry. ({} tries remaining)'.format( max_confirm_error)) max_confirm_error -= 1 domain = ask_question('Domain:') hpk_api.password_service.create( Password(name, login, password, domain, private=False)) print("Success!") return
def __checkExistingUserConfiguration(self): if (self.configManager.user()['fingerprint']): return ask_question( 'A configuration for the user [{}] is already present, continue ? [yes / NO] ' .format(self.configManager.user()['fingerprint']), False ) else: return True
def __checkExistingServerConfiguration(self): if (self.passboltServer.fingerprint or self.passboltServer.api.uri): return ask_question( 'A server configuration for [{}] is already present, continue ? [yes / NO] ' .format(self.passboltServer.api.uri), False ) else: return True
def msg(message): chat_id = message.from_user.id if chat_id in ads.state_dict: if ads.state_dict[chat_id] == 'text': utils.add_text(message) elif ads.state_dict[chat_id] == 'question': text = message.text + '\n@' + message.from_user.username del ads.state_dict[chat_id] bot_handlers.send_message(config.admin_id, text) bot_handlers.send_message(message.from_user.id, 'Ваш вопрос принят. Ожидайте ответа.') elif message.text == 'Создать объявление': utils.new_ad(chat_id, message.from_user.first_name) elif message.text == 'Задать вопрос': utils.ask_question(chat_id, message.from_user.username) elif message.text == 'Связаться с нами': utils.contacts(chat_id) else: utils.start_over(message)
def execute(self, hpk_api, args): password = password_selector(hpk_api) new_password = Password(password['attributes']['name'], password['attributes']['login'], password['attributes']['password'], password['attributes']['domain'], private=False) fields = prompt({ 'type': 'checkbox', 'name': 'fields', 'message': 'Which fields to modify?', 'choices': [{ 'name': 'Password name' }, { 'name': 'Login' }, { 'name': 'Password' }, { 'name': 'Domain' }] }).get('fields') if len(fields) == 0: return if 'Password name' in fields: new_password['name'] = ask_question('New password name:') if 'Login' in fields: new_password['login'] = ask_question('New login:'******'Password' in fields: new_password['password'] = ask_question('New password:'******'password') if 'Domain' in fields: new_password['domain'] = ask_question('New domaine:') hpk_api.password_service.update(password['id'], new_password) print('Success!') return
def setupServer(self): self.__displaySetupBanner('Server setup') if self.__checkExistingServerConfiguration(): # Get the server uri sys.stdout.write('Server URI : ') self.passboltServer.api.setURI(input()) self.passboltServer.api.setVerifyCert( not ask_question( 'Trust the server certficate without verification ? [yes / NO] ', False ) ) self.passboltServer.fetchServerIdentity() if ask_question( 'Server identity\n{}\nContinue ? [yes / NO] '.format(self.passboltServer), False): self.passboltServer.importServerIdentity() self.passboltServer.persist() self.logger.info('Server setup complete') return self.logger.info('Aborting server setup')
def ask_all_questions(): project_name = utils.ask_question("name:") venv = utils.ask_yes_no_question("Initialise a virtual environment?") flake = utils.ask_yes_no_question("Do you want flake8 linting enabled?") pytest = utils.ask_yes_no_question("Do you want pytest to be installed?") git = utils.ask_yes_no_question("Do you want to initialise a git repo?") readme = utils.ask_yes_no_question("Do you want to initialise a README?") return { "name": project_name, "venv": venv, "flake": flake, "pytest": pytest, "readme": readme, "git": git }
def __init__(self): self.bestiary = Bestiary() name = ask_question("What is your hero's name?'") self.hero = Hero(name) self.monster = self.bestiary.get_a_monster_for_level(self.hero.level)