@csrf_exempt
def first_time_get(request):
    print('first_time_get')
    df_list = []
    if (request.method == 'POST'):
        queriesManager = QueriesManager()
        (name, locations, start_date, end_date, word_list, logic, exact) = parse_parameters(request)
        max_results = request.POST.get('max_results', None)
        (total_users, total_tweets) = generate_users_tweets(request, use_words=True, tasdocs=True, uasdocs=True)
        if isinstance(total_users, Exception):
            return JsonResponse(str(total_users), safe=False, status=500)
        elif (len(total_tweets) == 0):
            return JsonResponse('Error: No Tweets in location and date', safe=False, status=500)
        print(len(total_tweets))
        print(len(total_users))
        for word in word_list:
            if exact:
                params = ['First_Time', [((' ' + word) + ' ')], [max_results]]
            else:
                params = ['First_Time', [word], [max_results]]
            print(params)
            df = queriesManager.call_querie(params, total_tweets, total_users)
            print(df)
            if df.empty:
                continue
            row_data = []
            for (index, row) in df.iterrows():
                row_data.append([row['id'], row['text'], row['screen_name'], convert_to_iso(row['full_date']), row['time_rnk']])
            df_list.append({'word': word, 'len': df.shape[0], 'row_data': row_data})
        if (len(df_list) == 0):
            return JsonResponse('Error: No Tweets in location and date contain search phrase', safe=False, status=500)
    return JsonResponse(df_list, safe=False)
@csrf_exempt
def first_time_get(request):
    print('first_time_get')
    df_list = []
    if (request.method == 'POST'):
        queriesManager = QueriesManager()
        (name, locations, start_date, end_date, word_list, logic, exact) = parse_parameters(request)
        max_results = request.POST.get('max_results', None)
        (total_users, total_tweets) = generate_users_tweets(request, use_words=True, tasdocs=True, uasdocs=True)
        if isinstance(total_users, Exception):
            return JsonResponse(str(total_users), safe=False, status=500)
        elif (len(total_tweets) == 0):
            return JsonResponse('Error: No Tweets in location and date', safe=False, status=500)
        print(len(total_tweets))
        print(len(total_users))
        for word in word_list:
            if exact:
                params = ['First_Time', [((' ' + word) + ' ')], [max_results]]
            else:
                params = ['First_Time', [word], [max_results]]
            print(params)
            df = queriesManager.call_querie(params, total_tweets, total_users)
            print(df)
            if df.empty:
                continue
            row_data = []
            for (index, row) in df.iterrows():
                row_data.append([row['id'], row['text'], row['screen_name'], convert_to_iso(row['full_date']), row['time_rnk']])
            df_list.append({'word': word, 'len': df.shape[0], 'row_data': row_data})
        if (len(df_list) == 0):
            return JsonResponse('Error: No Tweets in location and date contain search phrase', safe=False, status=500)
    return JsonResponse(df_list, safe=False)