Skip to content

Commit 66858a1

Browse files
few sample fixes (Azure#19122)
1 parent 996c680 commit 66858a1

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def sample_authentication_api_key_async():
5353
result = await document_translation_client.get_document_formats()
5454

5555

56-
def sample_authentication_with_azure_active_directory_async():
56+
async def sample_authentication_with_azure_active_directory_async():
5757
# [START create_dt_client_with_aad_async]
5858
"""DefaultAzureCredential will use the values from these environment
5959
variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
@@ -69,7 +69,7 @@ def sample_authentication_with_azure_active_directory_async():
6969

7070
# make calls with authenticated client
7171
async with document_translation_client:
72-
result = document_translation_client.get_document_formats()
72+
result = await document_translation_client.get_document_formats()
7373

7474

7575
async def main():

sdk/translation/azure-ai-translation-document/samples/async_samples/sample_check_document_statuses_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ async def sample_document_status_checks_async():
5858
))
5959
completed_docs.append(document.id)
6060
if document.status == "Failed":
61-
print("Document ID: {}, Error Code: {}, Message: {}".format(
62-
document.id, document.error.code, document.error.message
61+
print("Document at {} failed translation. Error Code: {}, Message: {}".format(
62+
document.source_document_url, document.error.code, document.error.message
6363
))
6464
completed_docs.append(document.id)
6565
if document.status == "Running":

sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_document_statuses_with_filters_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
async def sample_list_document_statuses_with_filters_async():
3030
# import libraries
3131
from azure.core.credentials import AzureKeyCredential
32-
from azure.ai.translation.document import (
32+
from azure.ai.translation.document.aio import (
3333
DocumentTranslationClient,
3434
)
3535
from datetime import datetime

sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translate_multiple_inputs_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async def sample_multiple_translation_async():
9797
if document.status == "Succeeded":
9898
print("Source document location: {}".format(document.source_document_url))
9999
print("Translated document location: {}".format(document.translated_document_url))
100-
print("Translated to language: {}\n".format(document.translate_to))
100+
print("Translated to language: {}\n".format(document.translated_to))
101101
else:
102102
print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message))
103103

sdk/translation/azure-ai-translation-document/samples/sample_check_document_statuses.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ def sample_document_status_checks():
5656
))
5757
completed_docs.append(document.id)
5858
if document.status == "Failed":
59-
print("Document ID: {}, Error Code: {}, Message: {}".format(
60-
document.id, document.error.code, document.error.message
59+
print("Document at {} failed translation. Error Code: {}, Message: {}".format(
60+
document.source_document_url, document.error.code, document.error.message
6161
))
6262
completed_docs.append(document.id)
6363
if document.status == "Running":
6464
print("Document ID: {}, translation progress is {} percent".format(
6565
document.id, document.translation_progress * 100
6666
))
6767

68-
print("\nTranslation completed.")
68+
print("\nTranslation completed.")
6969
# [END list_all_document_statuses]
7070

7171

sdk/translation/azure-ai-translation-document/samples/sample_translate_multiple_inputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def sample_multiple_translation():
9494
if document.status == "Succeeded":
9595
print("Source document location: {}".format(document.source_document_url))
9696
print("Translated document location: {}".format(document.translated_document_url))
97-
print("Translated to language: {}\n".format(document.translate_to))
97+
print("Translated to language: {}\n".format(document.translated_to))
9898
else:
9999
print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message))
100100

0 commit comments

Comments
 (0)