Skip to content

Commit

Permalink
change api next/prev links to use root domain
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanandrews committed Jan 22, 2025
1 parent c34edd2 commit 1cbd55c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion habhub-dataserver/habhub/core/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Global constants

API_URL = "https://habhub-api.whoi.edu"
# DATA_LAYERS constant = default Data Layers
CELL_CONCENTRATION_LAYER = "cell_concentration_layer"
CELL_CONCENTRATION_SPATIALGRID_LAYER = "cell_concentration_spatialgrid_layer"
Expand Down
11 changes: 8 additions & 3 deletions habhub-dataserver/habhub/ifcb_datasets/api2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth, helpers
from requests_aws4auth import AWS4Auth

from django.urls import reverse
from rest_framework import viewsets
from rest_framework.reverse import reverse

# from rest_framework.reverse import reverse
from rest_framework.response import Response
from rest_framework_gis.fields import GeometryField
from .mixins import ScoresFiltersMixin
from ..models import Dataset
from habhub.core.constants import API_URL

env = environ.Env()

Expand Down Expand Up @@ -63,8 +66,10 @@ def list(self, request):
query_params = request.query_params.dict()
query_params.pop("search_after", None)
query_params.pop("page", None)
link = reverse("api_v2:ifcb-species-scores-list", request=request)
print("link", link)
relative_link = reverse("api_v2:ifcb-species-scores-list")
print("link", relative_link)
link = f"{API_URL}{relative_link}"
print(link)
uri = f"{link}?{urllib.parse.urlencode(query_params)}"

current_page = int(request.query_params.get("page", 1))
Expand Down

0 comments on commit 1cbd55c

Please sign in to comment.