diff --git a/urls.py b/urls.py index 1f54539..375fffd 100644 --- a/urls.py +++ b/urls.py @@ -3,7 +3,7 @@ from .views import ConeSearchView urlpatterns = [ path( - 'cone_search///', + 'cone_search/', ConeSearchView.as_view(), name = 'cone_search' ), diff --git a/views.py b/views.py index 34e0593..483315b 100644 --- a/views.py +++ b/views.py @@ -49,11 +49,17 @@ class ConeSearchView(APIView): - def get(self, request, ra, dec, radius): + def get(self, request): # ra, dec, radius): - radius = float(radius) - ra = float(ra) - dec = float(dec) + try: + ra = float(request.query_params.get('ra')) + dec = float(request.query_params.get('dec')) + radius = float(request.query_params.get('radius')) + except (TypeError, ValueError): + return Response({"error": "Invalid parameters"}, status=status.HTTP_400_BAD_REQUEST) + # radius = float(radius) + # ra = float(ra) + # dec = float(dec) nside = 2048 #create skycoord for the center of search