[Python] How can I download an audio mp3 file and save it?

Discussão em 'Python' iniciado por Stack, Abril 15, 2025.

  1. Stack

    Stack Membro Participativo

    My View:

    class UserSearchView(APIView):

    def get(self, request, link):
    url = config('BASE_URL')
    querystring = {"track_url": f'https://stackoverflow.com/questions/74423351/how-can-i-download-an-audio-mp3-file-and-save-it'}
    headers = {
    "X-RapidAPI-Key": config('API_KEY'),
    "X-RapidAPI-Host": config('API_HOST')
    }

    response = requests.request("GET", url, headers=headers, params=querystring)

    data = response.json()


    return JsonResponse(data)



    My response :

    {
    "url": "https://result.s3.amazonaws.com/2022-11-13/61566981.mp3"
    }


    Not sure how to proceed here, can anyone help ?----------------------

    Continue reading...

Compartilhe esta Página