Skip to content

Commit

Permalink
few sample fixes (Azure#19122)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristapratico authored Jun 5, 2021
1 parent 996c680 commit 66858a1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def sample_authentication_api_key_async():
result = await document_translation_client.get_document_formats()


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

# make calls with authenticated client
async with document_translation_client:
result = document_translation_client.get_document_formats()
result = await document_translation_client.get_document_formats()


async def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ async def sample_document_status_checks_async():
))
completed_docs.append(document.id)
if document.status == "Failed":
print("Document ID: {}, Error Code: {}, Message: {}".format(
document.id, document.error.code, document.error.message
print("Document at {} failed translation. Error Code: {}, Message: {}".format(
document.source_document_url, document.error.code, document.error.message
))
completed_docs.append(document.id)
if document.status == "Running":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
async def sample_list_document_statuses_with_filters_async():
# import libraries
from azure.core.credentials import AzureKeyCredential
from azure.ai.translation.document import (
from azure.ai.translation.document.aio import (
DocumentTranslationClient,
)
from datetime import datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def sample_multiple_translation_async():
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.translate_to))
print("Translated to language: {}\n".format(document.translated_to))
else:
print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ def sample_document_status_checks():
))
completed_docs.append(document.id)
if document.status == "Failed":
print("Document ID: {}, Error Code: {}, Message: {}".format(
document.id, document.error.code, document.error.message
print("Document at {} failed translation. Error Code: {}, Message: {}".format(
document.source_document_url, document.error.code, document.error.message
))
completed_docs.append(document.id)
if document.status == "Running":
print("Document ID: {}, translation progress is {} percent".format(
document.id, document.translation_progress * 100
))

print("\nTranslation completed.")
print("\nTranslation completed.")
# [END list_all_document_statuses]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def sample_multiple_translation():
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.translate_to))
print("Translated to language: {}\n".format(document.translated_to))
else:
print("Error Code: {}, Message: {}\n".format(document.error.code, document.error.message))

Expand Down

0 comments on commit 66858a1

Please sign in to comment.