Added info endpoint

pull/1122/head
Luca Di Leo 2022-01-14 08:49:44 -08:00
rodzic 5087145c96
commit a6cf0b3daf
2 zmienionych plików z 14 dodań i 2 usunięć

Wyświetl plik

@ -181,7 +181,18 @@ class VerifyUrlTaskView(TaskView):
return Response({'count': res, 'success': True} if res else {'success': False}, status=status.HTTP_200_OK)
except Exception as e:
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
class InfoTaskView(TaskView):
def get(self, request):
datastore = get_current_plugin().get_user_data_store(request.user)
registry_url = datastore.get_string('registry_url') or None
username = datastore.get_string('username') or None
return Response({ 'hubUrl': registry_url, 'username': username }, status=status.HTTP_200_OK)
def import_files(task_id, carrier):
import requests

Wyświetl plik

@ -1,7 +1,7 @@
from app.plugins import PluginBase, Menu, MountPoint, logger
from coreplugins.dronedb.app_views import LoadButtonsView
from .api_views import FoldersTaskView, ImportDatasetTaskView, CheckCredentialsTaskView, OrganizationsTaskView, DatasetsTaskView, VerifyUrlTaskView
from .api_views import FoldersTaskView, ImportDatasetTaskView, CheckCredentialsTaskView, OrganizationsTaskView, DatasetsTaskView, VerifyUrlTaskView, InfoTaskView
from django.contrib import messages
from django.shortcuts import render
@ -41,6 +41,7 @@ class Plugin(PluginBase):
MountPoint("organizations/(?P<org>[^/.]+)/datasets", DatasetsTaskView.as_view()),
MountPoint("organizations", OrganizationsTaskView.as_view()),
MountPoint("verifyurl", VerifyUrlTaskView.as_view()),
MountPoint("info", InfoTaskView.as_view()),
#MountPoint("platforms/(?P<platform_name>[^/.]+)/verify", PlatformsVerifyTaskView.as_view()),
#MountPoint("platforms", PlatformsTaskView.as_view()),
]