mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 20:00:15 +00:00
add connection test api view
This commit is contained in:
parent
46622d9ab2
commit
9ab6955125
@ -6,6 +6,7 @@ from api.views import (
|
|||||||
DownloadApiListView,
|
DownloadApiListView,
|
||||||
DownloadApiView,
|
DownloadApiView,
|
||||||
LoginApiView,
|
LoginApiView,
|
||||||
|
PingView,
|
||||||
PlaylistApiView,
|
PlaylistApiView,
|
||||||
VideoApiListView,
|
VideoApiListView,
|
||||||
VideoApiView,
|
VideoApiView,
|
||||||
@ -14,6 +15,7 @@ from api.views import (
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path("ping/", PingView.as_view(), name="ping"),
|
||||||
path("login/", LoginApiView.as_view(), name="api-login"),
|
path("login/", LoginApiView.as_view(), name="api-login"),
|
||||||
path(
|
path(
|
||||||
"video/",
|
"video/",
|
||||||
|
@ -263,6 +263,18 @@ class DownloadApiListView(ApiBaseView):
|
|||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
||||||
|
|
||||||
|
class PingView(ApiBaseView):
|
||||||
|
"""resolves to /api/ping/
|
||||||
|
GET: test your connection
|
||||||
|
"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get(request):
|
||||||
|
"""get pong"""
|
||||||
|
data = {"pong": request.user.id}
|
||||||
|
return Response(data)
|
||||||
|
|
||||||
|
|
||||||
class LoginApiView(ObtainAuthToken):
|
class LoginApiView(ObtainAuthToken):
|
||||||
"""resolves to /api/login/
|
"""resolves to /api/login/
|
||||||
POST: return token and username after successful login
|
POST: return token and username after successful login
|
||||||
|
Loading…
Reference in New Issue
Block a user