

def get(self, request, *args, **kwargs):
    meter = request.GET.get('meter', None)
    if (not meter):
        return HttpResponse(json.dumps({
            
        }), content_type='application/json')
    meter_name = meter.replace('.', '_')
    date_options = request.GET.get('date_options', None)
    date_from = request.GET.get('date_from', None)
    date_to = request.GET.get('date_to', None)
    stats_attr = request.GET.get('stats_attr', 'avg')
    group_by = request.GET.get('group_by', None)
    try:
        (date_from, date_to) = utils_metering.calc_date_args(date_from, date_to, date_options)
    except Exception:
        exceptions.handle(self.request, _('Dates cannot be recognized.'))
    if (group_by == 'project'):
        query = utils_metering.ProjectAggregatesQuery(request, date_from, date_to, (3600 * 24))
    else:
        query = utils_metering.MeterQuery(request, date_from, date_to, (3600 * 24))
    (resources, unit) = query.query(meter)
    resource_name = ('id' if (group_by == 'project') else 'resource_id')
    series = self.series_for_meter(resources, resource_name, meter_name, stats_attr, unit)
    series = self.normalize_series_by_unit(series)
    ret = {
        'series': series,
        'settings': {
            
        },
    }
    return HttpResponse(json.dumps(ret), content_type='application/json')

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/dashboards/admin/metering/views.py SamplesView.get/original