from view_common import *
import random
from xos_analytics import DoXOSAnalytics

class DashboardAnalyticsAjaxView(View):
    url = r'^analytics/(?P<name>\w+)/$'

    def get(self, request, name="hello_world", **kwargs):
        if (name == "bigquery"):
            (mimetype, data) = DoXOSAnalytics(request)
            return HttpResponse(data, content_type=mimetype)
        else:
            return HttpResponse(json.dumps("Unknown"), content_type='application/javascript')
