changed the query format so that the parameters are extracted from the query string instead
This commit is contained in:
parent
ee8624e2ab
commit
fae86166e4
2
urls.py
2
urls.py
@ -3,7 +3,7 @@ from .views import ConeSearchView
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(
|
path(
|
||||||
'cone_search/<str:ra>/<str:dec>/<str:radius>',
|
'cone_search/',
|
||||||
ConeSearchView.as_view(),
|
ConeSearchView.as_view(),
|
||||||
name = 'cone_search'
|
name = 'cone_search'
|
||||||
),
|
),
|
||||||
|
14
views.py
14
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)
|
try:
|
||||||
ra = float(ra)
|
ra = float(request.query_params.get('ra'))
|
||||||
dec = float(dec)
|
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
|
nside = 2048
|
||||||
|
|
||||||
#create skycoord for the center of search
|
#create skycoord for the center of search
|
||||||
|
Loading…
x
Reference in New Issue
Block a user