Exemple #1
0
def add_a_snake():
    print(' ****************** Add a snake **************** ')

    account = state.active_account
    if not account:
        error_msg(f'Please Login or create an account')
        return

    name = input('What is your snake\'s name ? ')
    length = float(input('How long is your snake ?'))
    is_venomous = input('Is it venomous ?').lower().startswith("y")
    species = input('What species ?')

    snake = svc.add_snake(account, name, length, is_venomous, species)
    state.reload_account()
    success_msg(f'{snake.name} ({snake.id}) added to our snake directory')
Exemple #2
0
def add_a_snake():
    print(' ****************** Add a snake **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a snake")
        return

    name = input("What is your snake's name? ")
    if not name:
        error_msg('cancelled')
        return

    length = float(input('How long is your snake (in meters)? '))
    species = input("Species? ")
    is_venomous = input("Is your snake venomous [y]es, [n]o? ").lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, length, species, is_venomous)
    state.reload_account()
    success_msg('Created {} with id {}'.format(snake.name, snake.id))
def add_a_snake():
    print(' ****************** Add a snake **************** ')
    # TODO: Require an account
    if not state.active_account:
        print(f"You have to be logged in")
        return

    # TODO: Get snake info from user
    name = input('Enter name of snake')

    species = input('Enter Species of snake')
    length = int(input('Enter length of snake'))
    is_venomous = input('Is the snake venomous [y/n]').lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, species, length,
                          is_venomous)
    state.reload_account()
    print(f"successfully created snake {snake.name} with id {snake.id}")
def add_a_snake():
    print(' ****************** Add a snake **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a snake")
        return

    name = input("What is your snake's name? ")
    if not name:
        error_msg('cancelled')
        return

    length = float(input('How long is your snake (in meters)? '))
    species = input("Species? ")
    is_venomous = input("Is your snake venomous [y]es, [n]o? ").lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, length, species, is_venomous)
    state.reload_account()
    success_msg('Created {} with id {}'.format(snake.name, snake.id))
def add_a_snake():
    print(' ****************** Add a snake **************** ')

    if not state.active_account:
        hosts.error_msg("Must be logged in to register a cage")
        return

    species = input('Species: ')
    length = float(input('Length (m): '))
    venomous = input('Venomous snake (y/n)? ').startswith('y')

    name = input('Snake name: ')

    snake = svc.add_snake(state.active_account, name, species, length,
                          venomous)

    state.reload_account()
    hosts.success_msg(
        f'Snake {snake.name} created successfully with id {snake.id}')
def add_a_snake():
    print(' ****************** Add a snake **************** ')

    if not state.active_account:
        error_msg('You must login first to register a cage.')
        return

    name = input('What is the name of your snake? ')
    if not name:
        error_msg('Cancelled')
        return

    length = float(input('How long is your snake (in meters)? '))
    species = input('Species? ')
    venomous = input('Is your snake venomous [y, n]? ').lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, species, length,
                          venomous)
    state.reload_account()
    success_msg(f'Registered {snake.name} with id {snake.id}.')
def add_a_snake():
    #you can add multiple snakes in this way instead of adding one by one
    #snakes = [snake1,snake2,snake3.....]
    #Snake.objects().insert(snakes)
    print(' ****************** Add a snake **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a snake")
        return

    name = input("What is your snake's name? ")
    if not name:
        error_msg('cancelled')
        return

    length = float(input('How long is your snake (in meters)? '))
    species = input("Species? ")
    is_venomous = input(
        "Is your snake venomous [y]es, [n]o? ").lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, length, species,
                          is_venomous)
    state.reload_account()
    success_msg('Created {} with id {}'.format(snake.name, snake.id))