How to read file from DigitalOcean Spaces using Django?

I have a Django app that uses DigitalOcean Spaces to store user-uploaded files. The app then transcribes those files and returns the text. However when I try to read the file using the url to the stored file it fails. Here is my views.py:

This code saves the file to Spaces

        if form.is_valid():
            uploaded_file = request.FILES['file']

            request.session['uploaded_file_name'] = uploaded_file.name
            request.session['uploaded_file_size'] = uploaded_file.size#add to models

            session_id = str(uuid.uuid4())
            request.session['session_id'] = session_id
            
            transcribed_doc, created = TranscribedDocument.objects.get_or_create(id=session_id)
            transcribed_doc.audio_file = uploaded_file
            transcribed_doc.save()

            
            request.session['uploaded_file_path'] = transcribed_doc.audio_file.url#store url to file
            
#rest of code

This code reads the file:

    file_name = request.session.get('uploaded_file_name')
    file_path = request.session.get('uploaded_file_path')#store url in 'file_path' variable
    if request.method == 'POST':
        try:
            

            if not file_name or not file_path:
                return redirect (reverse('transcribeSubmit'))
            
            audio_language = request.POST.get('audio_language')
            output_file_type = request.POST.get('output_file_type')
        
            if file_name and file_path:
                file_extension = ('.' + (str(file_name).split('.')[-1]))
                
                #open file located at DO Spaces and initiate transcription
                with open(file_path, 'rb') as f:
                    path_string = f.name
                    destination_dir =  'ai_transcribe_output'
                    transcript = transcribe_file(path_string, audio_language, output_file_type, destination_dir)
             

My intention is to transcribe the file directly from the url at DO Spaces or if that is not feasible then instead to temporarily store a copy of the file locally so that it can be transcribed then deleted. I’m using django-storages[s3] to handle file storage.