написал запрос на получение всех треков

This commit is contained in:
Mike0001-droid 2024-06-20 15:50:42 +05:00
parent c3f3e30ad4
commit a99228f5c6
1 changed files with 11 additions and 0 deletions

View File

@ -174,6 +174,17 @@ class SongViewSet(GenericViewSet):
except ObjectDoesNotExist:
return Response({"error": 'Объекта не существует'}, status=status.HTTP_404_NOT_FOUND)
@action(detail=False, methods=['get'])
def get_all_song(self, request):
file_url = "http://82.97.242.49:10084/api/station/1/files"
API_KEY = "49226d3488aac3f5:18d88659c6c1c5e131a0ce0a94d55235"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
response = requests.get(file_url, headers=headers)
return Response(response.json(), status=status.HTTP_200_OK)