Exemplo n.º 1
0
def handle_key(delay, phonenumber, replay_digit):
    """
    If replay digit is -1, we are routed from greeting function and we need to
    get the pressed digit from the user and update the history.
    """
    if replay_digit == "-1":
        digits_pressed = int(request.values.get('Digits', None))
        utils.update_history(delay, phonenumber, str(digits_pressed))
    else:
        """
        Else we are replaying fizzbuzz from a previous call, and no update
        is necessary.
        """
        digits_pressed = int(replay_digit)

    resp = VoiceResponse()

    # Fizz Buzz
    for i in range(1, digits_pressed + 1):
        div_by_3 = i % 3 == 0
        div_by_5 = i % 5 == 0

        if div_by_3 and div_by_5:
            resp.say("Fizz Buzz")
        elif div_by_3:
            resp.say("Fizz")
        elif div_by_5:
            resp.say("Buzz")
        else:
            resp.say(str(i))
    resp.say("Have a nice day.")

    return str(resp)
Exemplo n.º 2
0
def update_china_trend():
    utils.update_history()
    utils.update_details()
    return render_template('china-trend.html')
Exemplo n.º 3
0
def update_all_world():
    utils.update_history()
    utils.update_details()
    utils.update_world()
    return "1"