def remove_contact(contact): """Removes a contact""" entry = [] try: entry.append(contact.split()[0]) except: entry.append('') try: entry.append(contact.split()[1]) except: entry.append('') db.delete_entry(db.get_id(entry))
def remove_contact(contact): """Removes a contact""" entry = [] try: entry.append(contact.split()[0]) except: entry.append('') try: entry.append(contact.split()[1]) except: entry.append(''); db.delete_entry(db.get_id(entry))
def webhook(): if request.method == 'GET': token = request.args.get('hub.verify_token') challenge = request.args.get('hub.challenge') if token == 'secret': return str(challenge) return '400' else: data = json.loads(request.data) print(data) messaging_events = data['entry'][0]['messaging'] bot = Bot(PAGE_ACCESS_TOKEN) for message in messaging_events: user_id = message['sender']['id'] text_input = message['message'].get('text') response_text = 'I am still learning' if text_input in GREETINGS: response_text = 'Hello. Welcome to my first bot!' elif check_width_height_syntax(text_input) is True: image_url = get_entry(user_id) if image_url is None: response_text = 'Please upload image first' else: bot.send_text_message(user_id, '..Processing your image..') resize_image(image_url, text_input) bot.send_image(user_id, 'output.png') bot.send_text_message(user_id, 'You are all set') delete_entry(user_id) return '200' else: attachments = message['message'].get('attachments') if attachments: attachment = attachments[0] attachment_type = attachment.get('type') if attachment_type == 'image': create_entry( user_id, (attachment.get('payload', {}).get('url'))) response_text = 'Thanks. I will help you resize. Tell me the size in width x height(200x100)' print('Message from user ID {} - {}'.format(user_id, text_input)) bot.send_text_message(user_id, response_text) return '200'
def remove_contact(contact): """Removes a contact. Keyword arguments: contact -- First and Last name of a contact entry """ entry = [] try: entry.append(contact.split()[0]) except: entry.append('') try: entry.append(contact.split()[1]) except: entry.append('') db.delete_entry(db.get_id(entry))
def remove_contact(contact): """Removes a contact. Keyword arguments: contact -- First and Last name of a contact entry """ entry = [] try: entry.append(contact.split()[0]) except: entry.append("") try: entry.append(contact.split()[1]) except: entry.append("") db.delete_entry(db.get_id(entry))
def delete(diary_id=None): '''We will delete the entry here, and return the status of the same.''' if delete_entry(diary_id) == True: return json.dumps({"result": "success"}) else: return json.dumps({"result": "error"})
def test_delete(test_id): ''' Delete teste entry ''' db.delete_entry(test_id) return jsonify(success=True)
print(user_menu()) #Input Menu Option op = input('Ingrese una opcion: ') clear() if (valid_menu_input(op)): if (op == '1'): print("\n\tCrear un nuevo registro") user = new_entry(user, user_credentials) elif (op == '2'): print("\n\tMostrar un registro") get_entry(user, user_credentials) elif (op == '3'): print("\n\tEliminar un registro") user = delete_entry(user, user_credentials) elif (op == '4'): wants_to_continue_user_menu = False else: error_msg( 'La opcion ingresada no es valida.') else: error_msg('La opcion ingresada no es valida.') else: error_msg("Las credenciales son invalidas.") elif (op == '2'): # Crear Usuario print("\n\tCrear un Usuario") user_name = input("\nIngrese su nombre de usuario:") password = input_password()