[Python] Azure Speech to Text API using file in blob storage- 415 response Unsupported Media...

Discussão em 'Python' iniciado por Stack, Janeiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to run the Azure speech to text resource on some audio held in blob storage, so I have a python program that creates the file in blob storage and then attempts to run the speech resource on the file, but I keep getting a 415 response and the response content is just "b''", so Im having trouble figuring out what is wrong below is my request code

    resp = requests.post(
    url,
    data={
    "displayName": filename,
    "locale": "en-GB",
    "contentContainerUrl": container_uri,
    "ContentUrls": [content_uri],
    "properties": {
    "diarizationEnabled": False,
    "wordLevelTimestampsEnabled": False,
    "punctuationMode": "DictatedAndAutomatic",
    "profanityFilterMode": "Masked"
    }
    },
    headers={"Ocp-Apim-Subscription-Key": sub_key, "Content-Type": "application/json"}
    )


    and here is the response

    displayName: Recording.wav
    Content container url:https://RESOURCE.blob.core.windows.net
    contents url: https://RESOURCE.blob.core.windows.net/cnnn-blob/Recording.wav
    <Response [415]>
    response content: b''


    I have searched around for people with similar problems, but theyre accessing different resources, and what worked for them (specifying content type, changing authorization method) isnt working for me. I have also tried uploading the same file converted to different file types, but I dont think the target file is the issue, as the 415 refers to the request itself right?

    Continue reading...

Compartilhe esta Página