def get(self, request, *args, **kwargs): service = kwargs.get('exposed') if not service: data = [{'name': s, 'url': reverse( 'monitoring:api_beacon_exposed', args=(s,))} for s in exposes.keys()] return json_response({'exposed': data}) try: ex = exposes[service]() except KeyError: return json_response( errors={'exposed': 'No service for {}'.format(service)}, status=404) out = {'data': ex.expose(), 'timestamp': datetime.utcnow().replace(tzinfo=pytz.utc)} return json_response(out)