всё вернул обратно
This commit is contained in:
parent
ef81bc7600
commit
628ffbc817
|
|
@ -7,7 +7,7 @@ from rest_framework import status
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
from rest_framework.permissions import AllowAny
|
from rest_framework.permissions import AllowAny
|
||||||
|
|
||||||
class FetchAndServeFile(ViewSet):
|
""" class FetchAndServeFile(ViewSet):
|
||||||
|
|
||||||
def list(self, request):
|
def list(self, request):
|
||||||
file_url = f"http://82.97.242.49:10084/api/station/it-radio/file/fc6377b2dae75d29358783bc/play"
|
file_url = f"http://82.97.242.49:10084/api/station/it-radio/file/fc6377b2dae75d29358783bc/play"
|
||||||
|
|
@ -29,7 +29,7 @@ class FetchAndServeFile(ViewSet):
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
|
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
""" def get(self, request, station, song_id, *args, **kwargs):
|
def get(self, request, station, song_id, *args, **kwargs):
|
||||||
file_url = f"http://82.97.242.49:10084/api/station/{station}/file/{song_id}/play"
|
file_url = f"http://82.97.242.49:10084/api/station/{station}/file/{song_id}/play"
|
||||||
api_key = "49226d3488aac3f5:18d88659c6c1c5e131a0ce0a94d55235"
|
api_key = "49226d3488aac3f5:18d88659c6c1c5e131a0ce0a94d55235"
|
||||||
|
|
||||||
|
|
@ -47,9 +47,9 @@ class FetchAndServeFile(ViewSet):
|
||||||
|
|
||||||
return file_response
|
return file_response
|
||||||
except requests.RequestException as e:
|
except requests.RequestException 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 FetchAndServeFile(APIView):
|
class FetchAndServeFile(APIView):
|
||||||
permission_classes = [AllowAny]
|
permission_classes = [AllowAny]
|
||||||
|
|
||||||
def get(self, request, station, song_id, *args, **kwargs):
|
def get(self, request, station, song_id, *args, **kwargs):
|
||||||
|
|
@ -70,4 +70,4 @@ class FetchAndServeFile(ViewSet):
|
||||||
|
|
||||||
return file_response
|
return file_response
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST) """
|
return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
@ -22,11 +22,11 @@ router = routers.DefaultRouter()
|
||||||
router.register(r'news', newsViews.NewsViewSet)
|
router.register(r'news', newsViews.NewsViewSet)
|
||||||
#router.register(r'profiles', ProfileViewSet, basename='profiles')
|
#router.register(r'profiles', ProfileViewSet, basename='profiles')
|
||||||
router.register(r'teams', TeamViewSet, basename='teams')
|
router.register(r'teams', TeamViewSet, basename='teams')
|
||||||
router.register(r'fetchandservefile', FetchAndServeFile, basename='fetchandservefile')
|
|
||||||
router.register(r'rubriks', RubricViewSet, basename='rubriks')
|
router.register(r'rubriks', RubricViewSet, basename='rubriks')
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('api/admin/', admin.site.urls),
|
path('api/admin/', admin.site.urls),
|
||||||
|
path('api/fetch-file/<str:station>/<str:song_id>/', FetchAndServeFile.as_view(), name='fetch-file'),
|
||||||
path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||||
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||||
path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
|
path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue