Exemplo n.º 1
0
def get_cube_mutual_funds_profit_intent_handler(request):
    resp = money_details()

    try:

        if resp.status_code == 200:

            # extracting data in json format
            resp_dict = resp.json()

            btrbankProfit = resp_dict['data']['btrbankProfit']

            wealthProfit = resp_dict['data']['wealthProfit']

            # No need to distinguish between the liquidity of these funds unless Alexa
            # user specifies if they want btrbank or wealth profit

            profit = int(btrbankProfit) + int(wealthProfit)

            speech_output = find_the_value('get_cube_profit') + profit

            card = alexa.create_card(title="Cube Intents",
                                     subtitle="Cube Mutual Funds Profit",
                                     content=speech_output)

            return alexa.create_response(message=speech_output,
                                         reprompt_message="I did not hear you",
                                         end_session=False,
                                         card_obj=card)

        else:

            print(resp.status_code)

            print("We couldn't connect to our server", resp.status_code)

    except requests.exceptions.ConnectionError:

        print("Connection Error! Http status Code {}".format(resp.status_code))

        sys.exit()

    except (requests.exceptions.RequestException,
            requests.exceptions.HTTPError):

        print("Ambiguous Error! Http status Code {}".format(resp.status_code))

        sys.exit()
Exemplo n.º 2
0
def get_cube_helping_number_intent_handler(request):
    resp = money_details()

    try:

        if resp.status_code == 200:

            # extracting data in json format
            resp_dict = resp.json()

            lives_impacted = resp_dict['data']['livesImpacted']

            speech_output = find_the_value(
                'get_cube_helping_number') + lives_impacted + " people"

            card = alexa.create_card(title="Cube Intents",
                                     subtitle="Cube People Helped",
                                     content=speech_output)

            return alexa.create_response(message=speech_output,
                                         reprompt_message="I did not hear you",
                                         end_session=False,
                                         card_obj=card)
        else:

            print(resp.status_code)

            print("We couldn't connect to our server", resp.status_code)

    except requests.exceptions.ConnectionError:

        print("Connection Error! Http status Code {}".format(resp.status_code))

        sys.exit()

    except (requests.exceptions.RequestException,
            requests.exceptions.HTTPError):

        print("Ambiguous Error! Http status Code {}".format(resp.status_code))

        sys.exit()
Exemplo n.º 3
0
def get_cube_mutual_funds_intent_handler(request):
    resp = money_details()

    try:

        if resp.status_code == 200:

            resp_dict = resp.json()

            total_mutual_funds = resp_dict['data']['totalFunds']

            speech_output = find_the_value(
                'get_cube_mutual_funds') + total_mutual_funds + " rupees"

            card = alexa.create_card(title="Cube Intents",
                                     subtitle="Cube Mutual Funds",
                                     content=speech_output)

            return alexa.create_response(message=speech_output,
                                         reprompt_message="I did not hear you",
                                         end_session=False,
                                         card_obj=card)

        else:

            print(resp.status_code)

            print("We couldn't connect to our server", resp.status_code)

    except requests.exceptions.ConnectionError:

        print("Connection Error! Http status Code {}".format(resp.status_code))

        sys.exit()

    except (requests.exceptions.RequestException,
            requests.exceptions.HTTPError):

        print("Ambiguous Error! Http status Code {}".format(resp.status_code))

        sys.exit()