ProductSearchAsyncClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Union[str, google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport] = 'grpc_asyncio', client_options: 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>)
Manages Products and ProductSets of reference images for use in product search. It uses the following resource model:
- The API has a collection of
ProductSet resources, named
projects/*/locations/*/productSets/*
, which acts as a way to put different products into groups to limit identification.
In parallel,
The API has a collection of Product resources, named
projects/*/locations/*/products/*
Each Product has a collection of ReferenceImage resources, named
projects/*/locations/*/products/*/referenceImages/*
Properties
transport
Returns the transport used by the client instance.
Returns | |
---|---|
Type | Description |
ProductSearchTransport | The transport used by the client instance. |
Methods
ProductSearchAsyncClient
ProductSearchAsyncClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Union[str, google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport] = 'grpc_asyncio', client_options: 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 product search 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 |
Union[str,
The transport to use. If set to None, a transport is chosen automatically. |
client_options |
ClientOptions
Custom options for the client. It won't take effect if a |
Exceptions | |
---|---|
Type | Description |
google.auth.exceptions.MutualTlsChannelError | If mutual TLS transport creation failed for any reason. |
add_product_to_product_set
add_product_to_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.AddProductToProductSetRequest, dict]] = None, *, name: Optional[str] = None, product: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[float, object] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())
Adds a Product to the specified ProductSet. If the Product is already present, no change is made.
One Product can be added to at most 100 ProductSets.
Possible errors:
- Returns NOT_FOUND if the Product or the ProductSet 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 vision_v1
async def sample_add_product_to_product_set():
# Create a client
client = vision_v1.ProductSearchAsyncClient()
# Initialize request argument(s)
request = vision_v1.AddProductToProductSetRequest(
name="name_value",
product="product_value",
)
# Make the request
await client.add_product_to_product_set(request=request)
Parameters | |
---|---|
Name | Description |
request |
Optional[Union[google.cloud.vision_v1.types.AddProductToProductSetRequest, dict]]
The request object. Request message for the |
name |
Required. The resource name for the ProductSet to modify. Format is: |
product |
Required. The resource name for the Product to be added to this ProductSet. Format is: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
common_billing_account_path
common_billing_account_path(billing_account: str)
Returns a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str)