Get statistics for selected Edookit users

    key:
      api key
    since:
      time as timestamp - get stats changed since

def user_stats_api(request, provider):
    """
    Get statistics for selected Edookit users

    key:
      api key
    since:
      time as timestamp - get stats changed since
    """

    if 'key' not in request.GET or provider not in settings.USER_STATS_API_KEY \
            or request.GET['key'] != settings.USER_STATS_API_KEY[provider]:
        return HttpResponse('Unauthorized', status=401)
    since = None
    if 'since' in request.GET:
        since = datetime.datetime.fromtimestamp(int(request.GET['since']))

    social_users = list(UserSocialAuth.objects.filter(provider=provider).select_related('user'))
    user_map = {u.user.id: u for u in social_users}
    stats = UserStat.objects.get_user_stats([u.user for u in social_users], lang=None, since=since, recalculate=False)
    data = {"users": []}
    for user, s in stats.items():
        data["users"].append({
            "user_id": user_map[user].uid,
            "concepts": s,
        })
    return render_json(request, data, template='concepts_json.html', help_text=user_stats_bulk.__doc__)