Skip to content

Commit

Permalink
Merge pull request #1 from BabyElias/develop
Browse files Browse the repository at this point in the history
l
  • Loading branch information
BabyElias authored Aug 28, 2024
2 parents aecc6f1 + 2faa5ea commit 6a97d2c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions kolibri/core/content/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,17 @@
from kolibri.core.device.models import ContentCacheKey
from kolibri.core.discovery.utils.network.client import NetworkClient
from kolibri.core.discovery.utils.network.errors import NetworkLocationConnectionFailure
from kolibri.core.discovery.utils.network.errors import NetworkLocationNotFound
from kolibri.core.discovery.utils.network.errors import NetworkLocationResponseFailure
from kolibri.core.discovery.utils.network.errors import ResourceGoneError
from kolibri.core.discovery.well_known import CENTRAL_CONTENT_BASE_URL
from kolibri.core.lessons.models import Lesson
from kolibri.core.logger.models import ContentSessionLog
from kolibri.core.logger.models import ContentSummaryLog
from kolibri.core.query import SQSum
from kolibri.core.utils.pagination import ValuesViewsetCursorPagination
from kolibri.core.utils.pagination import ValuesViewsetLimitOffsetPagination
from kolibri.core.utils.pagination import ValuesViewsetPageNumberPagination
from kolibri.utils import conf
from kolibri.utils.conf import OPTIONS
from kolibri.utils.urls import validator

Expand Down Expand Up @@ -1884,12 +1885,15 @@ def retrieve(self, request, pk=None):
@no_cache_on_method
def kolibri_studio_status(self, request, **kwargs):
try:
baseurl = conf.OPTIONS["Urls"]["CENTRAL_CONTENT_BASE_URL"]
client = NetworkClient.build_for_address(baseurl)
client = NetworkClient.build_for_address(CENTRAL_CONTENT_BASE_URL)
resp = client.get("/api/public/info")
data = resp.json()
data["available"] = True
data["status"] = "online"
return Response(data)
except (NetworkLocationResponseFailure, NetworkLocationConnectionFailure):
except (
NetworkLocationResponseFailure,
NetworkLocationConnectionFailure,
NetworkLocationNotFound,
):
return Response({"status": "offline", "available": False})

0 comments on commit 6a97d2c

Please sign in to comment.