TranslationServiceAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.translate_v3.services.translation_service.transports.base.TranslationServiceTransport, typing.Callable[[...], google.cloud.translate_v3.services.translation_service.transports.base.TranslationServiceTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Provides natural language translation operations.
Properties
api_endpoint
Return the API endpoint used by the client instance.
Returns | |
---|---|
Type | Description |
str |
The API endpoint used by the client instance. |
transport
Returns the transport used by the client instance.
Returns | |
---|---|
Type | Description |
TranslationServiceTransport |
The transport used by the client instance. |
universe_domain
Return the universe domain used by the client instance.
Returns | |
---|---|
Type | Description |
str |
The universe domain used by the client instance. |
Methods
TranslationServiceAsyncClient
TranslationServiceAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.translate_v3.services.translation_service.transports.base.TranslationServiceTransport, typing.Callable[[...], google.cloud.translate_v3.services.translation_service.transports.base.TranslationServiceTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Instantiates the translation service async client.
Parameters | |
---|---|
Name | Description |
credentials |
Optional[google.auth.credentials.Credentials]
The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. |
transport |
Optional[Union[str,TranslationServiceTransport,Callable[..., TranslationServiceTransport]]]
The transport to use, or a Callable that constructs and returns a new transport to use. If a Callable is given, it will be called with the same set of initialization arguments as used in the TranslationServiceTransport constructor. If set to None, a transport is chosen automatically. |
client_options |
Optional[Union[google.api_core.client_options.ClientOptions, dict]]
Custom options for the client. 1. The |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
Exceptions | |
---|---|
Type | Description |
google.auth.exceptions.MutualTlsChannelError |
If mutual TLS transport creation failed for any reason. |
adaptive_mt_dataset_path
adaptive_mt_dataset_path(project: str, location: str, dataset: str) -> str
Returns a fully-qualified adaptive_mt_dataset string.
adaptive_mt_file_path
adaptive_mt_file_path(project: str, location: str, dataset: str, file: str) -> str
Returns a fully-qualified adaptive_mt_file string.
adaptive_mt_sentence_path
adaptive_mt_sentence_path(
project: str, location: str, dataset: str, file: str, sentence: str
) -> str
Returns a fully-qualified adaptive_mt_sentence string.
adaptive_mt_translate
adaptive_mt_translate(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.AdaptiveMtTranslateRequest, dict
]
] = None,
*,
parent: typing.Optional[str] = None,
content: typing.Optional[typing.MutableSequence[str]] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.adaptive_mt.AdaptiveMtTranslateResponse
Translate text using Adaptive MT.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_adaptive_mt_translate():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.AdaptiveMtTranslateRequest(
parent="parent_value",
dataset="dataset_value",
content=['content_value1', 'content_value2'],
)
# Make the request
response = await client.adaptive_mt_translate(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.AdaptiveMtTranslateRequest, dict]]
The request object. The request for sending an AdaptiveMt translation query. |
parent |
Required. Location to make a regional call. Format: |
content |
:class:
Required. The content of the input in string format. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.AdaptiveMtTranslateResponse |
An AdaptiveMtTranslate response. |
batch_translate_document
batch_translate_document(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.BatchTranslateDocumentRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
source_language_code: typing.Optional[str] = None,
target_language_codes: typing.Optional[typing.MutableSequence[str]] = None,
input_configs: typing.Optional[
typing.MutableSequence[
google.cloud.translate_v3.types.translation_service.BatchDocumentInputConfig
]
] = None,
output_config: typing.Optional[
google.cloud.translate_v3.types.translation_service.BatchDocumentOutputConfig
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_batch_translate_document():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
input_configs = translate_v3.BatchDocumentInputConfig()
input_configs.gcs_source.input_uri = "input_uri_value"
output_config = translate_v3.BatchDocumentOutputConfig()
output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
request = translate_v3.BatchTranslateDocumentRequest(
parent="parent_value",
source_language_code="source_language_code_value",
target_language_codes=['target_language_codes_value1', 'target_language_codes_value2'],
input_configs=input_configs,
output_config=output_config,
)
# Make the request
operation = client.batch_translate_document(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.BatchTranslateDocumentRequest, dict]]
The request object. The BatchTranslateDocument request. |
parent |
Required. Location to make a regional call. Format: |
source_language_code |
Required. The ISO-639 language code of the input document if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in |
target_language_codes |
:class:
Required. The ISO-639 language code to use for translation of the input document. Specify up to 10 language codes here. This corresponds to the |
input_configs |
:class:
Required. Input configurations. The total number of files matched should be <= 100. The total content size to translate should be <= 100M Unicode codepoints. The files must use UTF-8 encoding. This corresponds to the |
output_config |
BatchDocumentOutputConfig
Required. Output configuration. If 2 input configs match to the same file (that is, same input path), we don't generate output for duplicate inputs. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be BatchTranslateDocumentResponse Stored in the google.longrunning.Operation.response][google.longrunning.Operation.response] field returned by BatchTranslateDocument if at least one document is translated successfully. |
batch_translate_text
batch_translate_text(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.BatchTranslateTextRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location.
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_batch_translate_text():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
input_configs = translate_v3.InputConfig()
input_configs.gcs_source.input_uri = "input_uri_value"
output_config = translate_v3.OutputConfig()
output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
request = translate_v3.BatchTranslateTextRequest(
parent="parent_value",
source_language_code="source_language_code_value",
target_language_codes=['target_language_codes_value1', 'target_language_codes_value2'],
input_configs=input_configs,
output_config=output_config,
)
# Make the request
operation = client.batch_translate_text(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.BatchTranslateTextRequest, dict]]
The request object. The batch translation request. |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be BatchTranslateResponse Stored in the google.longrunning.Operation.response][google.longrunning.Operation.response] field returned by BatchTranslateText if at least one sentence is translated successfully. |
cancel_operation
cancel_operation(
request: typing.Optional[
google.longrunning.operations_pb2.CancelOperationRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> None
Starts asynchronous cancellation on a long-running operation.
The server makes a best effort to cancel the operation, but success
is not guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
common_billing_account_path
common_billing_account_path(billing_account: str) -> str
Returns a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str) -> str
Returns a fully-qualified folder string.
common_location_path
common_location_path(project: str, location: str) -> str
Returns a fully-qualified location string.
common_organization_path
common_organization_path(organization: str) -> str
Returns a fully-qualified organization string.
common_project_path
common_project_path(project: str) -> str
Returns a fully-qualified project string.
create_adaptive_mt_dataset
create_adaptive_mt_dataset(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.CreateAdaptiveMtDatasetRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
adaptive_mt_dataset: typing.Optional[
google.cloud.translate_v3.types.adaptive_mt.AdaptiveMtDataset
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.adaptive_mt.AdaptiveMtDataset
Creates an Adaptive MT dataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_create_adaptive_mt_dataset():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
adaptive_mt_dataset = translate_v3.AdaptiveMtDataset()
adaptive_mt_dataset.name = "name_value"
request = translate_v3.CreateAdaptiveMtDatasetRequest(
parent="parent_value",
adaptive_mt_dataset=adaptive_mt_dataset,
)
# Make the request
response = await client.create_adaptive_mt_dataset(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.CreateAdaptiveMtDatasetRequest, dict]]
The request object. Request message for creating an AdaptiveMtDataset. |
parent |
Required. Name of the parent project. In form of |
adaptive_mt_dataset |
AdaptiveMtDataset
Required. The AdaptiveMtDataset to be created. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.AdaptiveMtDataset |
An Adaptive MT Dataset. |
create_dataset
create_dataset(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.CreateDatasetRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
dataset: typing.Optional[
google.cloud.translate_v3.types.automl_translation.Dataset
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Creates a Dataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_create_dataset():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.CreateDatasetRequest(
parent="parent_value",
)
# Make the request
operation = client.create_dataset(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.CreateDatasetRequest, dict]]
The request object. Request message for CreateDataset. |
parent |
Required. The project name. This corresponds to the |
dataset |
Dataset
Required. The Dataset to create. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be Dataset A dataset that hosts the examples (sentence pairs) used for translation models. |
create_glossary
create_glossary(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.CreateGlossaryRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
glossary: typing.Optional[
google.cloud.translate_v3.types.translation_service.Glossary
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_create_glossary():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
glossary = translate_v3.Glossary()
glossary.name = "name_value"
request = translate_v3.CreateGlossaryRequest(
parent="parent_value",
glossary=glossary,
)
# Make the request
operation = client.create_glossary(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.CreateGlossaryRequest, dict]]
The request object. Request message for CreateGlossary. |
parent |
Required. The project name. This corresponds to the |
glossary |
Glossary
Required. The glossary to create. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be Glossary Represents a glossary built from user-provided data. |
create_glossary_entry
create_glossary_entry(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.CreateGlossaryEntryRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
glossary_entry: typing.Optional[
google.cloud.translate_v3.types.common.GlossaryEntry
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.common.GlossaryEntry
Creates a glossary entry.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_create_glossary_entry():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.CreateGlossaryEntryRequest(
parent="parent_value",
)
# Make the request
response = await client.create_glossary_entry(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.CreateGlossaryEntryRequest, dict]]
The request object. Request message for CreateGlossaryEntry |
parent |
Required. The resource name of the glossary to create the entry under. This corresponds to the |
glossary_entry |
GlossaryEntry
Required. The glossary entry to create This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.GlossaryEntry |
Represents a single entry in a glossary. |
create_model
create_model(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.CreateModelRequest, dict
]
] = None,
*,
parent: typing.Optional[str] = None,
model: typing.Optional[
google.cloud.translate_v3.types.automl_translation.Model
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Creates a Model.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_create_model():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.CreateModelRequest(
parent="parent_value",
)
# Make the request
operation = client.create_model(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.CreateModelRequest, dict]]
The request object. Request message for CreateModel. |
parent |
Required. The project name, in form of |
model |
Model
Required. The Model to create. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be Model A trained translation model. |
dataset_path
dataset_path(project: str, location: str, dataset: str) -> str
Returns a fully-qualified dataset string.
delete_adaptive_mt_dataset
delete_adaptive_mt_dataset(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.DeleteAdaptiveMtDatasetRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> None
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_delete_adaptive_mt_dataset():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.DeleteAdaptiveMtDatasetRequest(
name="name_value",
)
# Make the request
await client.delete_adaptive_mt_dataset(request=request)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.DeleteAdaptiveMtDatasetRequest, dict]]
The request object. Request message for deleting an AdaptiveMtDataset. |
name |
Required. Name of the dataset. In the form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
delete_adaptive_mt_file
delete_adaptive_mt_file(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.DeleteAdaptiveMtFileRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> None
Deletes an AdaptiveMtFile along with its sentences.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_delete_adaptive_mt_file():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.DeleteAdaptiveMtFileRequest(
name="name_value",
)
# Make the request
await client.delete_adaptive_mt_file(request=request)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.DeleteAdaptiveMtFileRequest, dict]]
The request object. The request for deleting an AdaptiveMt file. |
name |
Required. The resource name of the file to delete, in form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
delete_dataset
delete_dataset(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.DeleteDatasetRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Deletes a dataset and all of its contents.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_delete_dataset():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.DeleteDatasetRequest(
name="name_value",
)
# Make the request
operation = client.delete_dataset(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.DeleteDatasetRequest, dict]]
The request object. Request message for DeleteDataset. |
name |
Required. The name of the dataset to delete. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } |
delete_glossary
delete_glossary(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.DeleteGlossaryRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_delete_glossary():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.DeleteGlossaryRequest(
name="name_value",
)
# Make the request
operation = client.delete_glossary(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.DeleteGlossaryRequest, dict]]
The request object. Request message for DeleteGlossary. |
name |
Required. The name of the glossary to delete. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be DeleteGlossaryResponse Stored in the google.longrunning.Operation.response][google.longrunning.Operation.response] field returned by DeleteGlossary. |
delete_glossary_entry
delete_glossary_entry(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.DeleteGlossaryEntryRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> None
Deletes a single entry from the glossary
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_delete_glossary_entry():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.DeleteGlossaryEntryRequest(
name="name_value",
)
# Make the request
await client.delete_glossary_entry(request=request)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.DeleteGlossaryEntryRequest, dict]]
The request object. Request message for Delete Glossary Entry |
name |
Required. The resource name of the glossary entry to delete This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
delete_model
delete_model(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.DeleteModelRequest, dict
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Deletes a model.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_delete_model():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.DeleteModelRequest(
name="name_value",
)
# Make the request
operation = client.delete_model(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.DeleteModelRequest, dict]]
The request object. Request message for DeleteModel. |
name |
Required. The name of the model to delete. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } |
delete_operation
delete_operation(
request: typing.Optional[
google.longrunning.operations_pb2.DeleteOperationRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> None
Deletes a long-running operation.
This method indicates that the client is no longer interested
in the operation result. It does not cancel the operation.
If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
detect_language
detect_language(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.DetectLanguageRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
model: typing.Optional[str] = None,
mime_type: typing.Optional[str] = None,
content: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.translation_service.DetectLanguageResponse
Detects the language of text within a request.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_detect_language():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.DetectLanguageRequest(
content="content_value",
parent="parent_value",
)
# Make the request
response = await client.detect_language(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.DetectLanguageRequest, dict]]
The request object. The request message for language detection. |
parent |
Required. Project or location to make a call. Must refer to a caller's project. Format: |
model |
Optional. The language detection model to be used. Format: |
mime_type |
Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". This corresponds to the |
content |
The content of the input stored as a string. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.DetectLanguageResponse |
The response message for language detection. |
example_path
example_path(project: str, location: str, dataset: str, example: str) -> str
Returns a fully-qualified example string.
export_data
export_data(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.ExportDataRequest, dict
]
] = None,
*,
dataset: typing.Optional[str] = None,
output_config: typing.Optional[
google.cloud.translate_v3.types.automl_translation.DatasetOutputConfig
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Exports dataset's data to the provided output location.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_export_data():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
output_config = translate_v3.DatasetOutputConfig()
output_config.gcs_destination.output_uri_prefix = "output_uri_prefix_value"
request = translate_v3.ExportDataRequest(
dataset="dataset_value",
output_config=output_config,
)
# Make the request
operation = client.export_data(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ExportDataRequest, dict]]
The request object. Request message for ExportData. |
dataset |
Required. Name of the dataset. In form of |
output_config |
DatasetOutputConfig
Required. The config for the output content. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } |
from_service_account_file
from_service_account_file(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
TranslationServiceAsyncClient |
The constructed client. |
from_service_account_info
from_service_account_info(info: dict, *args, **kwargs)
Creates an instance of this client using the provided credentials info.
Parameter | |
---|---|
Name | Description |
info |
dict
The service account private key info. |
Returns | |
---|---|
Type | Description |
TranslationServiceAsyncClient |
The constructed client. |
from_service_account_json
from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
TranslationServiceAsyncClient |
The constructed client. |
get_adaptive_mt_dataset
get_adaptive_mt_dataset(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.GetAdaptiveMtDatasetRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.adaptive_mt.AdaptiveMtDataset
Gets the Adaptive MT dataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_get_adaptive_mt_dataset():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.GetAdaptiveMtDatasetRequest(
name="name_value",
)
# Make the request
response = await client.get_adaptive_mt_dataset(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.GetAdaptiveMtDatasetRequest, dict]]
The request object. Request message for getting an Adaptive MT dataset. |
name |
Required. Name of the dataset. In the form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.AdaptiveMtDataset |
An Adaptive MT Dataset. |
get_adaptive_mt_file
get_adaptive_mt_file(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.GetAdaptiveMtFileRequest, dict
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.adaptive_mt.AdaptiveMtFile
Gets and AdaptiveMtFile
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_get_adaptive_mt_file():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.GetAdaptiveMtFileRequest(
name="name_value",
)
# Make the request
response = await client.get_adaptive_mt_file(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.GetAdaptiveMtFileRequest, dict]]
The request object. The request for getting an AdaptiveMtFile. |
name |
Required. The resource name of the file, in form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.AdaptiveMtFile |
An AdaptiveMtFile. |
get_dataset
get_dataset(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.GetDatasetRequest, dict
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.automl_translation.Dataset
Gets a Dataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_get_dataset():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.GetDatasetRequest(
name="name_value",
)
# Make the request
response = await client.get_dataset(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.GetDatasetRequest, dict]]
The request object. Request message for GetDataset. |
name |
Required. The resource name of the dataset to retrieve. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.Dataset |
A dataset that hosts the examples (sentence pairs) used for translation models. |
get_glossary
get_glossary(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.GetGlossaryRequest, dict
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.translation_service.Glossary
Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_get_glossary():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.GetGlossaryRequest(
name="name_value",
)
# Make the request
response = await client.get_glossary(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.GetGlossaryRequest, dict]]
The request object. Request message for GetGlossary. |
name |
Required. The name of the glossary to retrieve. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.Glossary |
Represents a glossary built from user-provided data. |
get_glossary_entry
get_glossary_entry(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.GetGlossaryEntryRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.common.GlossaryEntry
Gets a single glossary entry by the given id.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_get_glossary_entry():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.GetGlossaryEntryRequest(
name="name_value",
)
# Make the request
response = await client.get_glossary_entry(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.GetGlossaryEntryRequest, dict]]
The request object. Request message for the Get Glossary Entry Api |
name |
Required. The resource name of the glossary entry to get This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.GlossaryEntry |
Represents a single entry in a glossary. |
get_location
get_location(
request: typing.Optional[
google.cloud.location.locations_pb2.GetLocationRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.location.locations_pb2.Location
Gets information about a location.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
|
Location object. |
get_model
get_model(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.GetModelRequest, dict
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.automl_translation.Model
Gets a model.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_get_model():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.GetModelRequest(
name="name_value",
)
# Make the request
response = await client.get_model(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.GetModelRequest, dict]]
The request object. Request message for GetModel. |
name |
Required. The resource name of the model to retrieve. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.Model |
A trained translation model. |
get_mtls_endpoint_and_cert_source
get_mtls_endpoint_and_cert_source(
client_options: typing.Optional[
google.api_core.client_options.ClientOptions
] = None,
)
Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order:
(1) if GOOGLE_API_USE_CLIENT_CERTIFICATE
environment variable is not "true", the
client cert source is None.
(2) if client_options.client_cert_source
is provided, use the provided one; if the
default client cert source exists, use the default one; otherwise the client cert
source is None.
The API endpoint is determined in the following order:
(1) if client_options.api_endpoint
if provided, use the provided one.
(2) if GOOGLE_API_USE_CLIENT_CERTIFICATE
environment variable is "always", use the
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
Parameter | |
---|---|
Name | Description |
client_options |
google.api_core.client_options.ClientOptions
Custom options for the client. Only the |
Exceptions | |
---|---|
Type | Description |
google.auth.exceptions.MutualTLSChannelError |
If any errors happen. |
Returns | |
---|---|
Type | Description |
Tuple[str, Callable[[], Tuple[bytes, bytes]]] |
returns the API endpoint and the client cert source to use. |
get_operation
get_operation(
request: typing.Optional[
google.longrunning.operations_pb2.GetOperationRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.longrunning.operations_pb2.Operation
Gets the latest state of a long-running operation.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
|
An Operation object. |
get_supported_languages
get_supported_languages(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.GetSupportedLanguagesRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
model: typing.Optional[str] = None,
display_language_code: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.translation_service.SupportedLanguages
Returns a list of supported languages for translation.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_get_supported_languages():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.GetSupportedLanguagesRequest(
parent="parent_value",
)
# Make the request
response = await client.get_supported_languages(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.GetSupportedLanguagesRequest, dict]]
The request object. The request message for discovering supported languages. |
parent |
Required. Project or location to make a call. Must refer to a caller's project. Format: |
model |
Optional. Get supported languages of this model. The format depends on model type: - AutoML Translation models: |
display_language_code |
Optional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.SupportedLanguages |
The response message for discovering supported languages. |
get_transport_class
get_transport_class(
label: typing.Optional[str] = None,
) -> typing.Type[
google.cloud.translate_v3.services.translation_service.transports.base.TranslationServiceTransport
]
Returns an appropriate transport class.
Parameter | |
---|---|
Name | Description |
label |
typing.Optional[str]
The name of the desired transport. If none is provided, then the first transport in the registry is used. |
glossary_entry_path
glossary_entry_path(
project: str, location: str, glossary: str, glossary_entry: str
) -> str
Returns a fully-qualified glossary_entry string.
glossary_path
glossary_path(project: str, location: str, glossary: str) -> str
Returns a fully-qualified glossary string.
import_adaptive_mt_file
import_adaptive_mt_file(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.ImportAdaptiveMtFileRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.adaptive_mt.ImportAdaptiveMtFileResponse
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_import_adaptive_mt_file():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
file_input_source = translate_v3.FileInputSource()
file_input_source.mime_type = "mime_type_value"
file_input_source.content = b'content_blob'
file_input_source.display_name = "display_name_value"
request = translate_v3.ImportAdaptiveMtFileRequest(
file_input_source=file_input_source,
parent="parent_value",
)
# Make the request
response = await client.import_adaptive_mt_file(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ImportAdaptiveMtFileRequest, dict]]
The request object. The request for importing an AdaptiveMt file along with its sentences. |
parent |
Required. The resource name of the file, in form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.ImportAdaptiveMtFileResponse |
The response for importing an AdaptiveMtFile |
import_data
import_data(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.ImportDataRequest, dict
]
] = None,
*,
dataset: typing.Optional[str] = None,
input_config: typing.Optional[
google.cloud.translate_v3.types.automl_translation.DatasetInputConfig
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Import sentence pairs into translation Dataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_import_data():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ImportDataRequest(
dataset="dataset_value",
)
# Make the request
operation = client.import_data(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ImportDataRequest, dict]]
The request object. Request message for ImportData. |
dataset |
Required. Name of the dataset. In form of |
input_config |
DatasetInputConfig
Required. The config for the input content. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } |
list_adaptive_mt_datasets
list_adaptive_mt_datasets(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.ListAdaptiveMtDatasetsRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.translate_v3.services.translation_service.pagers.ListAdaptiveMtDatasetsAsyncPager
)
Lists all Adaptive MT datasets for which the caller has read permission.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_adaptive_mt_datasets():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListAdaptiveMtDatasetsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_adaptive_mt_datasets(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListAdaptiveMtDatasetsRequest, dict]]
The request object. Request message for listing all Adaptive MT datasets that the requestor has access to. |
parent |
Required. The resource name of the project from which to list the Adaptive MT datasets. |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListAdaptiveMtDatasetsAsyncPager |
A list of AdaptiveMtDatasets. Iterating over this object will yield results and resolve additional pages automatically. |
list_adaptive_mt_files
list_adaptive_mt_files(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.ListAdaptiveMtFilesRequest, dict
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.translate_v3.services.translation_service.pagers.ListAdaptiveMtFilesAsyncPager
)
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_adaptive_mt_files():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListAdaptiveMtFilesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_adaptive_mt_files(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListAdaptiveMtFilesRequest, dict]]
The request object. The request to list all AdaptiveMt files under a given dataset. |
parent |
Required. The resource name of the project from which to list the Adaptive MT files. |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListAdaptiveMtFilesAsyncPager |
The response for listing all AdaptiveMt files under a given dataset. Iterating over this object will yield results and resolve additional pages automatically. |
list_adaptive_mt_sentences
list_adaptive_mt_sentences(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.adaptive_mt.ListAdaptiveMtSentencesRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.translate_v3.services.translation_service.pagers.ListAdaptiveMtSentencesAsyncPager
)
Lists all AdaptiveMtSentences under a given file/dataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_adaptive_mt_sentences():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListAdaptiveMtSentencesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_adaptive_mt_sentences(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListAdaptiveMtSentencesRequest, dict]]
The request object. The request for listing Adaptive MT sentences from a Dataset/File. |
parent |
Required. The resource name of the project from which to list the Adaptive MT files. The following format lists all sentences under a file. |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListAdaptiveMtSentencesAsyncPager |
List AdaptiveMt sentences response. Iterating over this object will yield results and resolve additional pages automatically. |
list_datasets
list_datasets(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.ListDatasetsRequest, dict
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.translate_v3.services.translation_service.pagers.ListDatasetsAsyncPager
)
Lists datasets.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_datasets():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListDatasetsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_datasets(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListDatasetsRequest, dict]]
The request object. Request message for ListDatasets. |
parent |
Required. Name of the parent project. In form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListDatasetsAsyncPager |
Response message for ListDatasets. Iterating over this object will yield results and resolve additional pages automatically. |
list_examples
list_examples(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.ListExamplesRequest, dict
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.translate_v3.services.translation_service.pagers.ListExamplesAsyncPager
)
Lists sentence pairs in the dataset.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_examples():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListExamplesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_examples(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListExamplesRequest, dict]]
The request object. Request message for ListExamples. |
parent |
Required. Name of the parent dataset. In form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListExamplesAsyncPager |
Response message for ListExamples. Iterating over this object will yield results and resolve additional pages automatically. |
list_glossaries
list_glossaries(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.ListGlossariesRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.translate_v3.services.translation_service.pagers.ListGlossariesAsyncPager
)
Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_glossaries():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListGlossariesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_glossaries(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListGlossariesRequest, dict]]
The request object. Request message for ListGlossaries. |
parent |
Required. The name of the project from which to list all of the glossaries. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListGlossariesAsyncPager |
Response message for ListGlossaries. Iterating over this object will yield results and resolve additional pages automatically. |
list_glossary_entries
list_glossary_entries(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.ListGlossaryEntriesRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.translate_v3.services.translation_service.pagers.ListGlossaryEntriesAsyncPager
)
List the entries for the glossary.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_glossary_entries():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListGlossaryEntriesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_glossary_entries(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListGlossaryEntriesRequest, dict]]
The request object. Request message for ListGlossaryEntries |
parent |
Required. The parent glossary resource name for listing the glossary's entries. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListGlossaryEntriesAsyncPager |
Response message for ListGlossaryEntries Iterating over this object will yield results and resolve additional pages automatically. |
list_locations
list_locations(
request: typing.Optional[
google.cloud.location.locations_pb2.ListLocationsRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.location.locations_pb2.ListLocationsResponse
Lists information about the supported locations for this service.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
|
Response message for ListLocations method. |
list_models
list_models(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.automl_translation.ListModelsRequest, dict
]
] = None,
*,
parent: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.services.translation_service.pagers.ListModelsAsyncPager
Lists models.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_list_models():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.ListModelsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_models(request=request)
# Handle the response
async for response in page_result:
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.ListModelsRequest, dict]]
The request object. Request message for ListModels. |
parent |
Required. Name of the parent project. In form of |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.services.translation_service.pagers.ListModelsAsyncPager |
Response message for ListModels. Iterating over this object will yield results and resolve additional pages automatically. |
list_operations
list_operations(
request: typing.Optional[
google.longrunning.operations_pb2.ListOperationsRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.longrunning.operations_pb2.ListOperationsResponse
Lists operations that match the specified filter in the request.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
|
Response message for ListOperations method. |
model_path
model_path(project: str, location: str, model: str) -> str
Returns a fully-qualified model string.
parse_adaptive_mt_dataset_path
parse_adaptive_mt_dataset_path(path: str) -> typing.Dict[str, str]
Parses a adaptive_mt_dataset path into its component segments.
parse_adaptive_mt_file_path
parse_adaptive_mt_file_path(path: str) -> typing.Dict[str, str]
Parses a adaptive_mt_file path into its component segments.
parse_adaptive_mt_sentence_path
parse_adaptive_mt_sentence_path(path: str) -> typing.Dict[str, str]
Parses a adaptive_mt_sentence path into its component segments.
parse_common_billing_account_path
parse_common_billing_account_path(path: str) -> typing.Dict[str, str]
Parse a billing_account path into its component segments.
parse_common_folder_path
parse_common_folder_path(path: str) -> typing.Dict[str, str]
Parse a folder path into its component segments.
parse_common_location_path
parse_common_location_path(path: str) -> typing.Dict[str, str]
Parse a location path into its component segments.
parse_common_organization_path
parse_common_organization_path(path: str) -> typing.Dict[str, str]
Parse a organization path into its component segments.
parse_common_project_path
parse_common_project_path(path: str) -> typing.Dict[str, str]
Parse a project path into its component segments.
parse_dataset_path
parse_dataset_path(path: str) -> typing.Dict[str, str]
Parses a dataset path into its component segments.
parse_example_path
parse_example_path(path: str) -> typing.Dict[str, str]
Parses a example path into its component segments.
parse_glossary_entry_path
parse_glossary_entry_path(path: str) -> typing.Dict[str, str]
Parses a glossary_entry path into its component segments.
parse_glossary_path
parse_glossary_path(path: str) -> typing.Dict[str, str]
Parses a glossary path into its component segments.
parse_model_path
parse_model_path(path: str) -> typing.Dict[str, str]
Parses a model path into its component segments.
romanize_text
romanize_text(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.RomanizeTextRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
contents: typing.Optional[typing.MutableSequence[str]] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.translation_service.RomanizeTextResponse
Romanize input text written in non-Latin scripts to Latin text.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_romanize_text():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.RomanizeTextRequest(
parent="parent_value",
contents=['contents_value1', 'contents_value2'],
)
# Make the request
response = await client.romanize_text(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.RomanizeTextRequest, dict]]
The request object. The request message for synchronous romanization. |
parent |
Required. Project or location to make a call. Must refer to a caller's project. Format: |
contents |
:class:
Required. The content of the input in string format. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.RomanizeTextResponse |
The response message for synchronous romanization. |
translate_document
translate_document(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.TranslateDocumentRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.translation_service.TranslateDocumentResponse
Translates documents in synchronous mode.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_translate_document():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
document_input_config = translate_v3.DocumentInputConfig()
document_input_config.content = b'content_blob'
request = translate_v3.TranslateDocumentRequest(
parent="parent_value",
target_language_code="target_language_code_value",
document_input_config=document_input_config,
)
# Make the request
response = await client.translate_document(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.TranslateDocumentRequest, dict]]
The request object. A document translation request. |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.TranslateDocumentResponse |
A translated document response message. |
translate_text
translate_text(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.TranslateTextRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
target_language_code: typing.Optional[str] = None,
contents: typing.Optional[typing.MutableSequence[str]] = None,
model: typing.Optional[str] = None,
mime_type: typing.Optional[str] = None,
source_language_code: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.translation_service.TranslateTextResponse
Translates input text and returns translated text.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_translate_text():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.TranslateTextRequest(
contents=['contents_value1', 'contents_value2'],
target_language_code="target_language_code_value",
parent="parent_value",
)
# Make the request
response = await client.translate_text(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.TranslateTextRequest, dict]]
The request object. The request message for synchronous translation. |
parent |
Required. Project or location to make a call. Must refer to a caller's project. Format: |
target_language_code |
Required. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support. This corresponds to the |
contents |
:class:
Required. The content of the input in string format. We recommend the total content be less than 30,000 codepoints. The max length of this field is 1024. Use BatchTranslateText for larger text. This corresponds to the |
model |
Optional. The |
mime_type |
Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". This corresponds to the |
source_language_code |
Optional. The ISO-639 language code of the input text if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
update_glossary
update_glossary(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.UpdateGlossaryRequest,
dict,
]
] = None,
*,
glossary: typing.Optional[
google.cloud.translate_v3.types.translation_service.Glossary
] = None,
update_mask: typing.Optional[google.protobuf.field_mask_pb2.FieldMask] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation
Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_update_glossary():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
glossary = translate_v3.Glossary()
glossary.name = "name_value"
request = translate_v3.UpdateGlossaryRequest(
glossary=glossary,
)
# Make the request
operation = client.update_glossary(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.UpdateGlossaryRequest, dict]]
The request object. Request message for the update glossary flow |
glossary |
Glossary
Required. The glossary entry to update. This corresponds to the |
update_mask |
The list of fields to be updated. Currently only |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.api_core.operation_async.AsyncOperation |
An object representing a long-running operation. The result type for the operation will be Glossary Represents a glossary built from user-provided data. |
update_glossary_entry
update_glossary_entry(
request: typing.Optional[
typing.Union[
google.cloud.translate_v3.types.translation_service.UpdateGlossaryEntryRequest,
dict,
]
] = None,
*,
glossary_entry: typing.Optional[
google.cloud.translate_v3.types.common.GlossaryEntry
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.translate_v3.types.common.GlossaryEntry
Updates a glossary entry.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import translate_v3
async def sample_update_glossary_entry():
# Create a client
client = translate_v3.TranslationServiceAsyncClient()
# Initialize request argument(s)
request = translate_v3.UpdateGlossaryEntryRequest(
)
# Make the request
response = await client.update_glossary_entry(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.translate_v3.types.UpdateGlossaryEntryRequest, dict]]
The request object. Request message for UpdateGlossaryEntry |
glossary_entry |
GlossaryEntry
Required. The glossary entry to update. This corresponds to the |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
google.cloud.translate_v3.types.GlossaryEntry |
Represents a single entry in a glossary. |
wait_operation
wait_operation(
request: typing.Optional[
google.longrunning.operations_pb2.WaitOperationRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary_async.AsyncRetry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.longrunning.operations_pb2.Operation
Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state.
If the operation is already done, the latest state is immediately returned.
If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
timeout is used. If the server does not support this method, it returns
google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry_async.AsyncRetry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
Returns | |
---|---|
Type | Description |
|
An Operation object. |