Azure.ai.translation.document в Python — невозможно получить доступ к местоположению исходного документа с текущими разрPython

Программы на Python
Anonymous
Azure.ai.translation.document в Python — невозможно получить доступ к местоположению исходного документа с текущими разр

Сообщение Anonymous »

У меня возникли проблемы с библиотекой azure.ai.translation.document в Python. Я настроил службу перевода в Azure вместе с хранилищем BLOB-объектов с двумя контейнерами. Я создал подключения SAS, используя «ключ делегирования пользователя». Один для источника (Чтение/Список) и один для целевого объекта (Запись/Список).

например,

[img]https: //i.sstatic.net/9CNmW.png[/img]

Я попробовал запустить программу Python, но файл в исходном BLOB-объекте не был преобразован и сохранен в целевой BLOB-объект.< /p>
Я получаю эту ошибку:

Код: Выделить всё

azure.core.exceptions.HttpResponseError: (InvalidDocumentAccessLevel): Cannot access source document location with the current permissions.
Я использовал этот пример:
https://learn.microsoft.com/en-us/azure ... /document- Translation/client-sdks?tabs=python

Код: Выделить всё

import os from azure.core.credentials import AzureKeyCredential from azure.ai.translation.document import DocumentTranslationClient

key = "" endpoint = "" sourceUrl = "" targetUrl = ""

client = DocumentTranslationClient(endpoint, AzureKeyCredential(key))

poller = client.begin_translation(sourceUrl, targetUrl, "fr")
result = poller.result()

print("Status: {}".format(poller.status()))
print("Created on: {}".format(poller.details.created_on))
print("Last updated on: {}".format(poller.details.last_updated_on))
print("Total number of translations on documents: {}".format(poller.details.documents_total_count))

print("\nOf total documents...")
print("{} failed".format(poller.details.documents_failed_count))
print("{} succeeded".format(poller.details.documents_succeeded_count))

for document in result:
print("Document ID: {}".format(document.id))
print("Document status: {}".format(document.status))
if document.status == "Succeeded":
print("Source document location: {}".format(document.source_document_url))
print("Translated document location: {}".format(document.translated_document_url))
print("Translated to language: {}\n".format(document.translated_to))
else:
print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message))
Я использую Thonny в Windows в корпоративной среде (поскольку я все еще пытаюсь изучить Python). Возможно, наш облачный прокси-сервер что-то не так.
Спасибо
Лоз

Подробнее здесь: https://stackoverflow.com/questions/743 ... t-location

Вернуться в «Python»