@csrf_exempt
def tweet_list_place(request):
    print('tweet_list_place')
    if (request.method == 'POST'):
        (name, locations, start_date, end_date, word_list, logic, exact) = parse_parameters(request)
        print(('word list is: ' + str(word_list)))
        print(('logic is: ' + logic))
        if ((start_date is not '') and (end_date is not '')):
            days_list = generate_days_list(start_date, end_date)
        else:
            days_list = None
        print(days_list)
        total_tweets = []
        for loc in locations:
            place = get_user(name).get_region(loc['region']).get_place_by_name(loc['place'])
            mylist = place.get_tweets_directly(name, loc['region'], days_list, word_list, logic=logic, exact=exact)
            if isinstance(mylist, Exception):
                return JsonResponse(str(mylist), safe=False, status=500)
            json_list = []
            for l in mylist:
                result = generate_tweet_sendaway(l.tweet)
                ' this is the paid data from ibm watson\n                result.append(l.category)\n                result.append(l.concept)\n                result.append(l.entities)\n                result.append(l.entities_sentiment)\n                result.append(l.keywords)\n                result.append(l.keywords_sentiment)\n                '
                json_list.append(result)
            total_tweets = (total_tweets + json_list)
        if (len(total_tweets) == 0):
            return JsonResponse('Error: No Tweets in location / date / search phrase (if included)', safe=False, status=500)
        return JsonResponse(total_tweets, safe=False)
    else:
        empty = {}
        return JsonResponse(empty)
@csrf_exempt
def tweet_list_place(request):
    print('tweet_list_place')
    if (request.method == 'POST'):
        (name, locations, start_date, end_date, word_list, logic, exact) = parse_parameters(request)
        print(('word list is: ' + str(word_list)))
        print(('logic is: ' + logic))
        if ((start_date is not ) and (end_date is not )):
            days_list = generate_days_list(start_date, end_date)
        else:
            days_list = None
        print(days_list)
        total_tweets = []
        for loc in locations:
            place = get_user(name).get_region(loc['region']).get_place_by_name(loc['place'])
            mylist = place.get_tweets_directly(name, loc['region'], days_list, word_list, logic=logic, exact=exact)
            if isinstance(mylist, Exception):
                return JsonResponse(str(mylist), safe=False, status=500)
            json_list = []
            for l in mylist:
                result = generate_tweet_sendaway(l.tweet)
                ' this is the paid data from ibm watson\n                result.append(l.category)\n                result.append(l.concept)\n                result.append(l.entities)\n                result.append(l.entities_sentiment)\n                result.append(l.keywords)\n                result.append(l.keywords_sentiment)\n                '
                json_list.append(result)
            total_tweets = (total_tweets + json_list)
        if (len(total_tweets) == 0):
            return JsonResponse('Error: No Tweets in location / date / search phrase (if included)', safe=False, status=500)
        return JsonResponse(total_tweets, safe=False)
    else:
        empty = {}
        return JsonResponse(empty)