def what_to_pull(account, account_size, query_end_day, query_end_month, query_end_year, weekend, pull_type, query_size):
    x = 1
    while x == 1:
        if pull_type == "1":  # if DAU is chosen, request the end date and then find DAU
            app_data_daily(month=query_end_month, day=query_end_day, year=query_end_year, weekend=weekend,
                           account=account, query_size=query_size)
            app_opened(account, invites=account_size)
            x = 2

        elif pull_type == "2":  # if MAU is chosen, request the end date and then find MAU
            app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                           choice=1, weekend=weekend, account=account, query_size=query_size)
            app_opened(account, invites=account_size)
            x = 2

        elif pull_type == "3":  # if WAU is chosen, request the end date and then find MAU
            app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                           choice=2, weekend=weekend, account=account, query_size=query_size)
            app_opened(account, invites=account_size)
            x = 2

        elif pull_type == "4":  # if YAU is chosen, request the end date and then find MAU
            app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                           choice=3, weekend=weekend, account=account, query_size=query_size)
            app_opened(account, invites=account_size)
            x = 2

        elif pull_type == "5":  # if DAU/MAU is chosen, request the end date and then find both
            app_data_daily(month=query_end_month, day=query_end_day, year=query_end_year, weekend=weekend,
                           account=account, query_size=query_size)
            app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                           choice=1, weekend=weekend, account=account, query_size=query_size)
            app_opened(account, invites=account_size)
            x = 2

        elif pull_type == "6":  # if WAU/YAU is chosen, request the end date and then find both
            app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                           choice=2, weekend=weekend, account=account, query_size=query_size)
            app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                           choice=3, weekend=weekend, account=account, query_size=query_size)
            app_opened(account, invites=account_size)
            x = 2

        elif pull_type == "7":  # if WAU/YAU is chosen, request the end date and then find both
            cohort_pull(month=query_end_month, day=query_end_day, year=query_end_year, account=account,
                        query_size=query_size)
            return

        elif pull_type == "8":  # Use previous pull's data
            pull_type = input('\nWhat information did you use on the last pull?\n'
                              '1) DAU\n'
                              '2) MAU\n'
                              '3) WAU\n'
                              '4) YAU\n'
                              '5) Both DAU & MAU\n'
                              '6) Both WAU & YAU\n'
                              '7) Cohort Analysis\n')
            x = 2
        else:  # Error checking
            print("Wasn't a viable option, please pick again\n")

        python_graph(pull_type=pull_type)  # Creates the Python Graph
        data_end_use(pull_type=pull_type, data_use=None, account=None)
def multiple_companies(query_end_day, query_end_month, query_end_year, weekend, query_size):
    account_amount = 0
    try:
        account_amount = int(input("\nHow many accounts would you like to pull?"))
    except ValueError:
        print("That wasn't a number, please enter a number\n")

    print()
    amount = 0
    account_list = []
    account_invites_list = []
    account_invites = 0
    while amount < account_amount:
        amount += 1
        account = input('Enter account %s: ' % amount)
        if account in account_app_keys:
            account_invites = input('Enter account %s total invites: ' % amount)
            account_list.append(account)
            account_invites_list.append(account_invites)
        else:
            print("That wasn't a viable account, please try again or add to the account dictionary\n")
            amount -= 1
    decision1 = input('\nWhat information did you want to pull?\n'
                      '1) DAU\n'
                      '2) MAU\n'
                      '3) WAU\n'
                      '4) YAU\n'
                      '5) Both DAU & MAU\n'
                      '6) Both WAU & YAU\n')

    decision2 = input('What would you like to do with the information acquired?\n'
                      '1) Dump into a csv\n'
                      '2) Dump into a JSON\n'
                      '3) Create a Plotly graph\n'
                      '4) Nothing\n')

    for account in account_list:
        x = 1
        while x == 1:
            if decision1 == "1":  # if DAU is chosen, request the end date and then find DAU
                app_data_daily(month=query_end_month, day=query_end_day, year=query_end_year, weekend=weekend,
                               account=account, query_size=query_size)
                data_end_use(pull_type=decision1, data_use=decision2, account=account)
                app_opened(account, invites=account_invites)
                x = 2

            elif decision1 == "2":  # if MAU is chosen, request the end date and then find MAU
                app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                               choice=1, weekend=weekend, account=account, query_size=query_size)
                data_end_use(pull_type=decision1, data_use=decision2, account=account)
                app_opened(account, invites=account_invites)
                x = 2

            elif decision1 == "3":  # if WAU is chosen, request the end date and then find MAU
                app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                               choice=2, weekend=weekend, account=account, query_size=query_size)
                data_end_use(pull_type=decision1, data_use=decision2, account=account)
                app_opened(account, invites=account_invites)
                x = 2

            elif decision1 == "4":  # if YAU is chosen, request the end date and then find MAU
                app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                               choice=3, weekend=weekend, account=account, query_size=query_size)
                data_end_use(pull_type=decision1, data_use=decision2, account=account)
                app_opened(account, invites=account_invites)
                x = 2

            elif decision1 == "5":  # if DAU/MAU is chosen, request the end date and then find both
                app_data_daily(month=query_end_month, day=query_end_day, year=query_end_year, weekend=weekend,
                               account=account, query_size=query_size)
                app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                               choice=1, weekend=weekend, account=account, query_size=query_size)
                data_end_use(pull_type=decision1, data_use=decision2, account=account)
                app_opened(account, invites=account_invites)
                x = 2

            elif decision1 == "6":  # if WAU/YAU is chosen, request the end date and then find both
                app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                               choice=2, weekend=weekend, account=account, query_size=query_size)
                app_data_weekly_monthly_yearly(month=query_end_month, day=query_end_day, year=query_end_year,
                                               choice=3, weekend=weekend, account=account, query_size=query_size)
                data_end_use(pull_type=decision1, data_use=decision2, account=account)
                app_opened(account, invites=account_invites)
                x = 2
            else:  # Error checking
                print("Wasn't a viable option, please pick again\n")