"""Manipulate Markov data via the Django site.""" import logging from rest_framework.authentication import BasicAuthentication from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.decorators import api_view, authentication_classes, permission_classes from weather.lib import weather_summary logger = logging.getLogger(__name__) @api_view(['GET']) @authentication_classes((BasicAuthentication, )) @permission_classes((IsAuthenticated, )) def rpc_weather_report(request, query): """Provide the weather report for a given query.""" if request.method != 'GET': return Response({'detail': "Supported method: GET."}, status=405) report = weather_summary(query) return Response(report)