ProductSearch¶
- class google.cloud.vision_v1.services.product_search.ProductSearchAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport, typing.Callable[[...], google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport]]] = '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>)[source]¶
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][google.cloud.vision.v1.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][google.cloud.vision.v1.Product] resources, named
projects/*/locations/*/products/*
Each [Product][google.cloud.vision.v1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named
projects/*/locations/*/products/*/referenceImages/*
Instantiates the product search async client.
- Parameters
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,ProductSearchTransport,Callable[..., ProductSearchTransport]]]) – 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 ProductSearchTransport 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
api_endpoint
property can be used to override the default endpoint provided by the client whentransport
is not explicitly provided. Only if this property is not set andtransport
was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the
client_cert_source
property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.3. The
universe_domain
property can be used to override the default “googleapis.com” universe. Note thatapi_endpoint
property still takes precedence; anduniverse_domain
is currently not supported for mTLS.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
None
, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
- Raises
google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.
- async 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: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
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
request (Optional[Union[google.cloud.vision_v1.types.AddProductToProductSetRequest, dict]]) – The request object. Request message for the
AddProductToProductSet
method.name (
str
) –Required. The resource name for the ProductSet to modify.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.product (
str
) –Required. The resource name for the Product to be added to this ProductSet.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
product
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- property api_endpoint¶
Return the API endpoint used by the client instance.
- Returns
The API endpoint used by the client instance.
- Return type
- static common_billing_account_path(billing_account: str) str ¶
Returns a fully-qualified billing_account string.
- static common_location_path(project: str, location: str) str ¶
Returns a fully-qualified location string.
- static common_organization_path(organization: str) str ¶
Returns a fully-qualified organization string.
- async create_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.CreateProductRequest, dict]] = None, *, parent: Optional[str] = None, product: Optional[google.cloud.vision_v1.types.product_search_service.Product] = None, product_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.Product [source]¶
Creates and returns a new product resource.
Possible errors:
Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
Returns INVALID_ARGUMENT if description is longer than 4096 characters.
Returns INVALID_ARGUMENT if product_category is missing or invalid.
# 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_create_product(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.CreateProductRequest( parent="parent_value", ) # Make the request response = await client.create_product(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.CreateProductRequest, dict]]) – The request object. Request message for the
CreateProduct
method.parent (
str
) –Required. The project in which the Product should be created.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.product (
google.cloud.vision_v1.types.Product
) – Required. The product to create. This corresponds to theproduct
field on therequest
instance; ifrequest
is provided, this should not be set.product_id (
str
) –A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
/
.This corresponds to the
product_id
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A Product contains ReferenceImages.
- Return type
- async create_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.CreateProductSetRequest, dict]] = None, *, parent: Optional[str] = None, product_set: Optional[google.cloud.vision_v1.types.product_search_service.ProductSet] = None, product_set_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ProductSet [source]¶
Creates and returns a new ProductSet resource.
Possible errors:
Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
# 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_create_product_set(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.CreateProductSetRequest( parent="parent_value", ) # Make the request response = await client.create_product_set(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.CreateProductSetRequest, dict]]) – The request object. Request message for the
CreateProductSet
method.parent (
str
) –Required. The project in which the ProductSet should be created.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.product_set (
google.cloud.vision_v1.types.ProductSet
) – Required. The ProductSet to create. This corresponds to theproduct_set
field on therequest
instance; ifrequest
is provided, this should not be set.product_set_id (
str
) –A user-supplied resource id for this ProductSet. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
/
.This corresponds to the
product_set_id
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.
- Return type
- async create_reference_image(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.CreateReferenceImageRequest, dict]] = None, *, parent: Optional[str] = None, reference_image: Optional[google.cloud.vision_v1.types.product_search_service.ReferenceImage] = None, reference_image_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ReferenceImage [source]¶
Creates and returns a new ReferenceImage resource.
The
bounding_poly
field is optional. Ifbounding_poly
is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).
Possible errors:
Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
Returns INVALID_ARGUMENT if the product does not exist.
Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product’s product_category is detected.
Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
# 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_create_reference_image(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) reference_image = vision_v1.ReferenceImage() reference_image.uri = "uri_value" request = vision_v1.CreateReferenceImageRequest( parent="parent_value", reference_image=reference_image, ) # Make the request response = await client.create_reference_image(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.CreateReferenceImageRequest, dict]]) – The request object. Request message for the
CreateReferenceImage
method.parent (
str
) –Required. Resource name of the product in which to create the reference image.
Format is
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.reference_image (
google.cloud.vision_v1.types.ReferenceImage
) –Required. The reference image to create. If an image ID is specified, it is ignored.
This corresponds to the
reference_image
field on therequest
instance; ifrequest
is provided, this should not be set.reference_image_id (
str
) –A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
/
.This corresponds to the
reference_image_id
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
- A ReferenceImage represents a product image and its associated metadata,
such as bounding boxes.
- Return type
- async delete_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.DeleteProductRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Permanently deletes a product and its reference images. Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.
# 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_delete_product(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.DeleteProductRequest( name="name_value", ) # Make the request await client.delete_product(request=request)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.DeleteProductRequest, dict]]) – The request object. Request message for the
DeleteProduct
method.name (
str
) –Required. Resource name of product to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- async delete_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.DeleteProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.
The actual image files are not deleted from Google Cloud Storage.
# 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_delete_product_set(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.DeleteProductSetRequest( name="name_value", ) # Make the request await client.delete_product_set(request=request)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.DeleteProductSetRequest, dict]]) – The request object. Request message for the
DeleteProductSet
method.name (
str
) –Required. Resource name of the ProductSet to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- async delete_reference_image(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.DeleteReferenceImageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Permanently deletes a reference image.
The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.
The actual image files are not deleted from Google Cloud Storage.
# 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_delete_reference_image(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.DeleteReferenceImageRequest( name="name_value", ) # Make the request await client.delete_reference_image(request=request)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.DeleteReferenceImageRequest, dict]]) – The request object. Request message for the
DeleteReferenceImage
method.name (
str
) –Required. The resource name of the reference image to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- classmethod from_service_account_file(filename: str, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_info(info: dict, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
info.
- Parameters
info (dict) – The service account private key info.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_json(filename: str, *args, **kwargs)¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]¶
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.
- Parameters
client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.
- Returns
- returns the API endpoint and the
client cert source to use.
- Return type
- Raises
google.auth.exceptions.MutualTLSChannelError – If any errors happen.
- async get_operation(request: Optional[google.longrunning.operations_pb2.GetOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.longrunning.operations_pb2.Operation [source]¶
Gets the latest state of a long-running operation.
- Parameters
request (
GetOperationRequest
) – The request object. Request message for GetOperation method.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An
Operation
object.- Return type
Operation
- async get_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.GetProductRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.Product [source]¶
Gets information associated with a Product.
Possible errors:
Returns NOT_FOUND if the Product does not 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_get_product(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.GetProductRequest( name="name_value", ) # Make the request response = await client.get_product(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.GetProductRequest, dict]]) – The request object. Request message for the
GetProduct
method.name (
str
) –Required. Resource name of the Product to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A Product contains ReferenceImages.
- Return type
- async get_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.GetProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ProductSet [source]¶
Gets information associated with a ProductSet.
Possible errors:
Returns NOT_FOUND if the ProductSet does not 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_get_product_set(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.GetProductSetRequest( name="name_value", ) # Make the request response = await client.get_product_set(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.GetProductSetRequest, dict]]) – The request object. Request message for the
GetProductSet
method.name (
str
) –Required. Resource name of the ProductSet to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.
- Return type
- async get_reference_image(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.GetReferenceImageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ReferenceImage [source]¶
Gets information associated with a ReferenceImage.
Possible errors:
Returns NOT_FOUND if the specified image does not 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_get_reference_image(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.GetReferenceImageRequest( name="name_value", ) # Make the request response = await client.get_reference_image(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.GetReferenceImageRequest, dict]]) – The request object. Request message for the
GetReferenceImage
method.name (
str
) –Required. The resource name of the ReferenceImage to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID
.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
- A ReferenceImage represents a product image and its associated metadata,
such as bounding boxes.
- Return type
- classmethod get_transport_class(label: Optional[str] = None) Type[google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport] ¶
Returns an appropriate transport class.
- Parameters
label – The name of the desired transport. If none is provided, then the first transport in the registry is used.
- Returns
The transport class to use.
- async import_product_sets(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ImportProductSetsRequest, dict]] = None, *, parent: Optional[str] = None, input_config: Optional[google.cloud.vision_v1.types.product_search_service.ImportProductSetsInputConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation [source]¶
Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.
The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request.
Operation.metadata
containsBatchOperationMetadata
. (progress)Operation.response
containsImportProductSetsResponse
. (results)The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
# 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_import_product_sets(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ImportProductSetsRequest( parent="parent_value", ) # Make the request operation = client.import_product_sets(request=request) print("Waiting for operation to complete...") response = (await operation).result() # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.ImportProductSetsRequest, dict]]) – The request object. Request message for the
ImportProductSets
method.parent (
str
) –Required. The project in which the ProductSets should be imported.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.input_config (
google.cloud.vision_v1.types.ImportProductSetsInputConfig
) –Required. The input content for the list of requests.
This corresponds to the
input_config
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
An object representing a long-running operation.
The result type for the operation will be
google.cloud.vision_v1.types.ImportProductSetsResponse
Response message for the ImportProductSets method.This message is returned by the [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
- Return type
- async list_product_sets(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListProductSetsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager [source]¶
Lists ProductSets in an unspecified order.
Possible errors:
Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
# 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_list_product_sets(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListProductSetsRequest( parent="parent_value", ) # Make the request page_result = client.list_product_sets(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.ListProductSetsRequest, dict]]) – The request object. Request message for the
ListProductSets
method.parent (
str
) –Required. The project from which ProductSets should be listed.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Response message for the ListProductSets method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager
- async list_products(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListProductsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager [source]¶
Lists products in an unspecified order.
Possible errors:
Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
# 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_list_products(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListProductsRequest( parent="parent_value", ) # Make the request page_result = client.list_products(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.ListProductsRequest, dict]]) – The request object. Request message for the
ListProducts
method.parent (
str
) –Required. The project OR ProductSet from which Products should be listed.
Format:
projects/PROJECT_ID/locations/LOC_ID
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Response message for the ListProducts method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager
- async list_products_in_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager [source]¶
Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.
Possible errors:
Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
# 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_list_products_in_product_set(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListProductsInProductSetRequest( name="name_value", ) # Make the request page_result = client.list_products_in_product_set(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.ListProductsInProductSetRequest, dict]]) – The request object. Request message for the
ListProductsInProductSet
method.name (
str
) –Required. The ProductSet resource for which to retrieve Products.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Response message for the ListProductsInProductSet method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager
- async list_reference_images(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListReferenceImagesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager [source]¶
Lists reference images.
Possible errors:
Returns NOT_FOUND if the parent product does not exist.
Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
# 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_list_reference_images(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListReferenceImagesRequest( parent="parent_value", ) # Make the request page_result = client.list_reference_images(request=request) # Handle the response async for response in page_result: print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.ListReferenceImagesRequest, dict]]) – The request object. Request message for the
ListReferenceImages
method.parent (
str
) –Required. Resource name of the product containing the reference images.
Format is
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
Response message for the ListReferenceImages method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager
- static parse_common_billing_account_path(path: str) Dict[str, str] ¶
Parse a billing_account path into its component segments.
- static parse_common_folder_path(path: str) Dict[str, str] ¶
Parse a folder path into its component segments.
- static parse_common_location_path(path: str) Dict[str, str] ¶
Parse a location path into its component segments.
- static parse_common_organization_path(path: str) Dict[str, str] ¶
Parse a organization path into its component segments.
- static parse_common_project_path(path: str) Dict[str, str] ¶
Parse a project path into its component segments.
- static parse_product_path(path: str) Dict[str, str] ¶
Parses a product path into its component segments.
- static parse_product_set_path(path: str) Dict[str, str] ¶
Parses a product_set path into its component segments.
- static parse_reference_image_path(path: str) Dict[str, str] ¶
Parses a reference_image path into its component segments.
- static product_path(project: str, location: str, product: str) str ¶
Returns a fully-qualified product string.
- static product_set_path(project: str, location: str, product_set: str) str ¶
Returns a fully-qualified product_set string.
- async purge_products(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.PurgeProductsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation_async.AsyncOperation [source]¶
Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.
If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.
It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.
It’s not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.
If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.
The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request.
Operation.metadata
containsBatchOperationMetadata
. (progress)# 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_purge_products(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.PurgeProductsRequest( parent="parent_value", ) # Make the request operation = client.purge_products(request=request) print("Waiting for operation to complete...") response = (await operation).result() # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.PurgeProductsRequest, dict]]) – The request object. Request message for the
PurgeProducts
method.parent (
str
) –Required. The project and location in which the Products should be deleted.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
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);
}
- The result type for the operation will be
- Return type
- static reference_image_path(project: str, location: str, product: str, reference_image: str) str ¶
Returns a fully-qualified reference_image string.
- async remove_product_from_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.RemoveProductFromProductSetRequest, dict]] = None, *, name: Optional[str] = None, product: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Removes a Product from the specified ProductSet.
# 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_remove_product_from_product_set(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.RemoveProductFromProductSetRequest( name="name_value", product="product_value", ) # Make the request await client.remove_product_from_product_set(request=request)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.RemoveProductFromProductSetRequest, dict]]) – The request object. Request message for the
RemoveProductFromProductSet
method.name (
str
) –Required. The resource name for the ProductSet to modify.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.product (
str
) –Required. The resource name for the Product to be removed from this ProductSet.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
product
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- property transport: google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport¶
Returns the transport used by the client instance.
- Returns
The transport used by the client instance.
- Return type
ProductSearchTransport
- property universe_domain: str¶
Return the universe domain used by the client instance.
- Returns
- The universe domain used
by the client instance.
- Return type
- async update_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.UpdateProductRequest, dict]] = None, *, product: Optional[google.cloud.vision_v1.types.product_search_service.Product] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.Product [source]¶
Makes changes to a Product resource. Only the
display_name
,description
, andlabels
fields can be updated right now.If labels are updated, the change will not be reflected in queries until the next index time.
Possible errors:
Returns NOT_FOUND if the Product does not exist.
Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
Returns INVALID_ARGUMENT if product_category is present in update_mask.
# 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_update_product(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.UpdateProductRequest( ) # Make the request response = await client.update_product(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.UpdateProductRequest, dict]]) – The request object. Request message for the
UpdateProduct
method.product (
google.cloud.vision_v1.types.Product
) –Required. The Product resource which replaces the one on the server. product.name is immutable.
This corresponds to the
product
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask
) –The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn’t specified, all mutable fields are to be updated. Valid mask paths include
product_labels
,display_name
, anddescription
.This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A Product contains ReferenceImages.
- Return type
- async update_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.UpdateProductSetRequest, dict]] = None, *, product_set: Optional[google.cloud.vision_v1.types.product_search_service.ProductSet] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ProductSet [source]¶
Makes changes to a ProductSet resource. Only display_name can be updated currently.
Possible errors:
Returns NOT_FOUND if the ProductSet does not exist.
Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters.
# 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_update_product_set(): # Create a client client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.UpdateProductSetRequest( ) # Make the request response = await client.update_product_set(request=request) # Handle the response print(response)
- Parameters
request (Optional[Union[google.cloud.vision_v1.types.UpdateProductSetRequest, dict]]) – The request object. Request message for the
UpdateProductSet
method.product_set (
google.cloud.vision_v1.types.ProductSet
) –Required. The ProductSet resource which replaces the one on the server.
This corresponds to the
product_set
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (
google.protobuf.field_mask_pb2.FieldMask
) –The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn’t specified, all mutable fields are to be updated. Valid mask path is
display_name
.This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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, str]]) – Strings which should be sent along with the request as metadata.
- Returns
A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.
- Return type
- class google.cloud.vision_v1.services.product_search.ProductSearchClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport, typing.Callable[[...], google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]¶
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][google.cloud.vision.v1.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][google.cloud.vision.v1.Product] resources, named
projects/*/locations/*/products/*
Each [Product][google.cloud.vision.v1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named
projects/*/locations/*/products/*/referenceImages/*
Instantiates the product search client.
- Parameters
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,ProductSearchTransport,Callable[..., ProductSearchTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the ProductSearchTransport 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
api_endpoint
property can be used to override the default endpoint provided by the client whentransport
is not explicitly provided. Only if this property is not set andtransport
was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the
client_cert_source
property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.3. The
universe_domain
property can be used to override the default “googleapis.com” universe. Note that theapi_endpoint
property still takes precedence; anduniverse_domain
is currently not supported for mTLS.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
None
, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
- Raises
google.auth.exceptions.MutualTLSChannelError – If mutual TLS transport creation failed for any reason.
- __exit__(type, value, traceback)[source]¶
Releases underlying transport’s resources.
Warning
ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!
- 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: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
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 def sample_add_product_to_product_set(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.AddProductToProductSetRequest( name="name_value", product="product_value", ) # Make the request client.add_product_to_product_set(request=request)
- Parameters
request (Union[google.cloud.vision_v1.types.AddProductToProductSetRequest, dict]) – The request object. Request message for the
AddProductToProductSet
method.name (str) –
Required. The resource name for the ProductSet to modify.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.product (str) –
Required. The resource name for the Product to be added to this ProductSet.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
product
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- property api_endpoint¶
Return the API endpoint used by the client instance.
- Returns
The API endpoint used by the client instance.
- Return type
- static common_billing_account_path(billing_account: str) str [source]¶
Returns a fully-qualified billing_account string.
- static common_location_path(project: str, location: str) str [source]¶
Returns a fully-qualified location string.
- static common_organization_path(organization: str) str [source]¶
Returns a fully-qualified organization string.
- create_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.CreateProductRequest, dict]] = None, *, parent: Optional[str] = None, product: Optional[google.cloud.vision_v1.types.product_search_service.Product] = None, product_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.Product [source]¶
Creates and returns a new product resource.
Possible errors:
Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
Returns INVALID_ARGUMENT if description is longer than 4096 characters.
Returns INVALID_ARGUMENT if product_category is missing or invalid.
# 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 def sample_create_product(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.CreateProductRequest( parent="parent_value", ) # Make the request response = client.create_product(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.CreateProductRequest, dict]) – The request object. Request message for the
CreateProduct
method.parent (str) –
Required. The project in which the Product should be created.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.product (google.cloud.vision_v1.types.Product) – Required. The product to create. This corresponds to the
product
field on therequest
instance; ifrequest
is provided, this should not be set.product_id (str) –
A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
/
.This corresponds to the
product_id
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A Product contains ReferenceImages.
- Return type
- create_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.CreateProductSetRequest, dict]] = None, *, parent: Optional[str] = None, product_set: Optional[google.cloud.vision_v1.types.product_search_service.ProductSet] = None, product_set_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ProductSet [source]¶
Creates and returns a new ProductSet resource.
Possible errors:
Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
# 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 def sample_create_product_set(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.CreateProductSetRequest( parent="parent_value", ) # Make the request response = client.create_product_set(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.CreateProductSetRequest, dict]) – The request object. Request message for the
CreateProductSet
method.parent (str) –
Required. The project in which the ProductSet should be created.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.product_set (google.cloud.vision_v1.types.ProductSet) – Required. The ProductSet to create. This corresponds to the
product_set
field on therequest
instance; ifrequest
is provided, this should not be set.product_set_id (str) –
A user-supplied resource id for this ProductSet. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
/
.This corresponds to the
product_set_id
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.
- Return type
- create_reference_image(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.CreateReferenceImageRequest, dict]] = None, *, parent: Optional[str] = None, reference_image: Optional[google.cloud.vision_v1.types.product_search_service.ReferenceImage] = None, reference_image_id: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ReferenceImage [source]¶
Creates and returns a new ReferenceImage resource.
The
bounding_poly
field is optional. Ifbounding_poly
is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).
Possible errors:
Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
Returns INVALID_ARGUMENT if the product does not exist.
Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product’s product_category is detected.
Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
# 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 def sample_create_reference_image(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) reference_image = vision_v1.ReferenceImage() reference_image.uri = "uri_value" request = vision_v1.CreateReferenceImageRequest( parent="parent_value", reference_image=reference_image, ) # Make the request response = client.create_reference_image(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.CreateReferenceImageRequest, dict]) – The request object. Request message for the
CreateReferenceImage
method.parent (str) –
Required. Resource name of the product in which to create the reference image.
Format is
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.reference_image (google.cloud.vision_v1.types.ReferenceImage) –
Required. The reference image to create. If an image ID is specified, it is ignored.
This corresponds to the
reference_image
field on therequest
instance; ifrequest
is provided, this should not be set.reference_image_id (str) –
A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character
/
.This corresponds to the
reference_image_id
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
- A ReferenceImage represents a product image and its associated metadata,
such as bounding boxes.
- Return type
- delete_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.DeleteProductRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Permanently deletes a product and its reference images. Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.
# 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 def sample_delete_product(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.DeleteProductRequest( name="name_value", ) # Make the request client.delete_product(request=request)
- Parameters
request (Union[google.cloud.vision_v1.types.DeleteProductRequest, dict]) – The request object. Request message for the
DeleteProduct
method.name (str) –
Required. Resource name of product to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- delete_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.DeleteProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.
The actual image files are not deleted from Google Cloud Storage.
# 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 def sample_delete_product_set(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.DeleteProductSetRequest( name="name_value", ) # Make the request client.delete_product_set(request=request)
- Parameters
request (Union[google.cloud.vision_v1.types.DeleteProductSetRequest, dict]) – The request object. Request message for the
DeleteProductSet
method.name (str) –
Required. Resource name of the ProductSet to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- delete_reference_image(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.DeleteReferenceImageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Permanently deletes a reference image.
The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.
The actual image files are not deleted from Google Cloud Storage.
# 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 def sample_delete_reference_image(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.DeleteReferenceImageRequest( name="name_value", ) # Make the request client.delete_reference_image(request=request)
- Parameters
request (Union[google.cloud.vision_v1.types.DeleteReferenceImageRequest, dict]) – The request object. Request message for the
DeleteReferenceImage
method.name (str) –
Required. The resource name of the reference image to delete.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- classmethod from_service_account_file(filename: str, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_info(info: dict, *args, **kwargs)[source]¶
- Creates an instance of this client using the provided credentials
info.
- Parameters
info (dict) – The service account private key info.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod from_service_account_json(filename: str, *args, **kwargs)¶
- Creates an instance of this client using the provided credentials
file.
- Parameters
filename (str) – The path to the service account private key json file.
args – Additional arguments to pass to the constructor.
kwargs – Additional arguments to pass to the constructor.
- Returns
The constructed client.
- Return type
- classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]¶
Deprecated. 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.
- Parameters
client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.
- Returns
- returns the API endpoint and the
client cert source to use.
- Return type
- Raises
google.auth.exceptions.MutualTLSChannelError – If any errors happen.
- get_operation(request: Optional[google.longrunning.operations_pb2.GetOperationRequest] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.longrunning.operations_pb2.Operation [source]¶
Gets the latest state of a long-running operation.
- Parameters
request (
GetOperationRequest
) – The request object. Request message for GetOperation method.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.
- Returns
An
Operation
object.- Return type
Operation
- get_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.GetProductRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.Product [source]¶
Gets information associated with a Product.
Possible errors:
Returns NOT_FOUND if the Product does not 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 def sample_get_product(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.GetProductRequest( name="name_value", ) # Make the request response = client.get_product(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.GetProductRequest, dict]) – The request object. Request message for the
GetProduct
method.name (str) –
Required. Resource name of the Product to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A Product contains ReferenceImages.
- Return type
- get_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.GetProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ProductSet [source]¶
Gets information associated with a ProductSet.
Possible errors:
Returns NOT_FOUND if the ProductSet does not 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 def sample_get_product_set(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.GetProductSetRequest( name="name_value", ) # Make the request response = client.get_product_set(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.GetProductSetRequest, dict]) – The request object. Request message for the
GetProductSet
method.name (str) –
Required. Resource name of the ProductSet to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.
- Return type
- get_reference_image(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.GetReferenceImageRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ReferenceImage [source]¶
Gets information associated with a ReferenceImage.
Possible errors:
Returns NOT_FOUND if the specified image does not 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 def sample_get_reference_image(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.GetReferenceImageRequest( name="name_value", ) # Make the request response = client.get_reference_image(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.GetReferenceImageRequest, dict]) – The request object. Request message for the
GetReferenceImage
method.name (str) –
Required. The resource name of the ReferenceImage to get.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID
.This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
- A ReferenceImage represents a product image and its associated metadata,
such as bounding boxes.
- Return type
- import_product_sets(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ImportProductSetsRequest, dict]] = None, *, parent: Optional[str] = None, input_config: Optional[google.cloud.vision_v1.types.product_search_service.ImportProductSetsInputConfig] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation [source]¶
Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.
The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request.
Operation.metadata
containsBatchOperationMetadata
. (progress)Operation.response
containsImportProductSetsResponse
. (results)The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
# 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 def sample_import_product_sets(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.ImportProductSetsRequest( parent="parent_value", ) # Make the request operation = client.import_product_sets(request=request) print("Waiting for operation to complete...") response = operation.result() # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.ImportProductSetsRequest, dict]) – The request object. Request message for the
ImportProductSets
method.parent (str) –
Required. The project in which the ProductSets should be imported.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.input_config (google.cloud.vision_v1.types.ImportProductSetsInputConfig) –
Required. The input content for the list of requests.
This corresponds to the
input_config
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
An object representing a long-running operation.
The result type for the operation will be
google.cloud.vision_v1.types.ImportProductSetsResponse
Response message for the ImportProductSets method.This message is returned by the [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
- Return type
- list_product_sets(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListProductSetsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager [source]¶
Lists ProductSets in an unspecified order.
Possible errors:
Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
# 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 def sample_list_product_sets(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.ListProductSetsRequest( parent="parent_value", ) # Make the request page_result = client.list_product_sets(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.ListProductSetsRequest, dict]) – The request object. Request message for the
ListProductSets
method.parent (str) –
Required. The project from which ProductSets should be listed.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for the ListProductSets method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager
- list_products(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListProductsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListProductsPager [source]¶
Lists products in an unspecified order.
Possible errors:
Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
# 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 def sample_list_products(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.ListProductsRequest( parent="parent_value", ) # Make the request page_result = client.list_products(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.ListProductsRequest, dict]) – The request object. Request message for the
ListProducts
method.parent (str) –
Required. The project OR ProductSet from which Products should be listed.
Format:
projects/PROJECT_ID/locations/LOC_ID
This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for the ListProducts method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListProductsPager
- list_products_in_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager [source]¶
Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.
Possible errors:
Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
# 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 def sample_list_products_in_product_set(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.ListProductsInProductSetRequest( name="name_value", ) # Make the request page_result = client.list_products_in_product_set(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.ListProductsInProductSetRequest, dict]) – The request object. Request message for the
ListProductsInProductSet
method.name (str) –
Required. The ProductSet resource for which to retrieve Products.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for the ListProductsInProductSet method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager
- list_reference_images(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.ListReferenceImagesRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager [source]¶
Lists reference images.
Possible errors:
Returns NOT_FOUND if the parent product does not exist.
Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
# 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 def sample_list_reference_images(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.ListReferenceImagesRequest( parent="parent_value", ) # Make the request page_result = client.list_reference_images(request=request) # Handle the response for response in page_result: print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.ListReferenceImagesRequest, dict]) – The request object. Request message for the
ListReferenceImages
method.parent (str) –
Required. Resource name of the product containing the reference images.
Format is
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
Response message for the ListReferenceImages method.
Iterating over this object will yield results and resolve additional pages automatically.
- Return type
google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager
- static parse_common_billing_account_path(path: str) Dict[str, str] [source]¶
Parse a billing_account path into its component segments.
- static parse_common_folder_path(path: str) Dict[str, str] [source]¶
Parse a folder path into its component segments.
- static parse_common_location_path(path: str) Dict[str, str] [source]¶
Parse a location path into its component segments.
- static parse_common_organization_path(path: str) Dict[str, str] [source]¶
Parse a organization path into its component segments.
- static parse_common_project_path(path: str) Dict[str, str] [source]¶
Parse a project path into its component segments.
- static parse_product_path(path: str) Dict[str, str] [source]¶
Parses a product path into its component segments.
- static parse_product_set_path(path: str) Dict[str, str] [source]¶
Parses a product_set path into its component segments.
- static parse_reference_image_path(path: str) Dict[str, str] [source]¶
Parses a reference_image path into its component segments.
- static product_path(project: str, location: str, product: str) str [source]¶
Returns a fully-qualified product string.
- static product_set_path(project: str, location: str, product_set: str) str [source]¶
Returns a fully-qualified product_set string.
- purge_products(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.PurgeProductsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.api_core.operation.Operation [source]¶
Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.
If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.
It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.
It’s not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.
If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.
The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the progress and results of the request.
Operation.metadata
containsBatchOperationMetadata
. (progress)# 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 def sample_purge_products(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.PurgeProductsRequest( parent="parent_value", ) # Make the request operation = client.purge_products(request=request) print("Waiting for operation to complete...") response = operation.result() # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.PurgeProductsRequest, dict]) – The request object. Request message for the
PurgeProducts
method.parent (str) –
Required. The project and location in which the Products should be deleted.
Format is
projects/PROJECT_ID/locations/LOC_ID
.This corresponds to the
parent
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
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);
}
- The result type for the operation will be
- Return type
- static reference_image_path(project: str, location: str, product: str, reference_image: str) str [source]¶
Returns a fully-qualified reference_image string.
- remove_product_from_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.RemoveProductFromProductSetRequest, dict]] = None, *, name: Optional[str] = None, product: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None [source]¶
Removes a Product from the specified ProductSet.
# 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 def sample_remove_product_from_product_set(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.RemoveProductFromProductSetRequest( name="name_value", product="product_value", ) # Make the request client.remove_product_from_product_set(request=request)
- Parameters
request (Union[google.cloud.vision_v1.types.RemoveProductFromProductSetRequest, dict]) – The request object. Request message for the
RemoveProductFromProductSet
method.name (str) –
Required. The resource name for the ProductSet to modify.
Format is:
projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID
This corresponds to the
name
field on therequest
instance; ifrequest
is provided, this should not be set.product (str) –
Required. The resource name for the Product to be removed from this ProductSet.
Format is:
projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID
This corresponds to the
product
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- property transport: google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport¶
Returns the transport used by the client instance.
- Returns
- The transport used by the client
instance.
- Return type
ProductSearchTransport
- property universe_domain: str¶
Return the universe domain used by the client instance.
- Returns
The universe domain used by the client instance.
- Return type
- update_product(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.UpdateProductRequest, dict]] = None, *, product: Optional[google.cloud.vision_v1.types.product_search_service.Product] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.Product [source]¶
Makes changes to a Product resource. Only the
display_name
,description
, andlabels
fields can be updated right now.If labels are updated, the change will not be reflected in queries until the next index time.
Possible errors:
Returns NOT_FOUND if the Product does not exist.
Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
Returns INVALID_ARGUMENT if product_category is present in update_mask.
# 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 def sample_update_product(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.UpdateProductRequest( ) # Make the request response = client.update_product(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.UpdateProductRequest, dict]) – The request object. Request message for the
UpdateProduct
method.product (google.cloud.vision_v1.types.Product) –
Required. The Product resource which replaces the one on the server. product.name is immutable.
This corresponds to the
product
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn’t specified, all mutable fields are to be updated. Valid mask paths include
product_labels
,display_name
, anddescription
.This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A Product contains ReferenceImages.
- Return type
- update_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.UpdateProductSetRequest, dict]] = None, *, product_set: Optional[google.cloud.vision_v1.types.product_search_service.ProductSet] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.vision_v1.types.product_search_service.ProductSet [source]¶
Makes changes to a ProductSet resource. Only display_name can be updated currently.
Possible errors:
Returns NOT_FOUND if the ProductSet does not exist.
Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters.
# 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 def sample_update_product_set(): # Create a client client = vision_v1.ProductSearchClient() # Initialize request argument(s) request = vision_v1.UpdateProductSetRequest( ) # Make the request response = client.update_product_set(request=request) # Handle the response print(response)
- Parameters
request (Union[google.cloud.vision_v1.types.UpdateProductSetRequest, dict]) – The request object. Request message for the
UpdateProductSet
method.product_set (google.cloud.vision_v1.types.ProductSet) –
Required. The ProductSet resource which replaces the one on the server.
This corresponds to the
product_set
field on therequest
instance; ifrequest
is provided, this should not be set.update_mask (google.protobuf.field_mask_pb2.FieldMask) –
The [FieldMask][google.protobuf.FieldMask] that specifies which fields to update. If update_mask isn’t specified, all mutable fields are to be updated. Valid mask path is
display_name
.This corresponds to the
update_mask
field on therequest
instance; ifrequest
is provided, this should not be set.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.
- Returns
A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.
- Return type
- class google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager(method: Callable[[...], Awaitable[google.cloud.vision_v1.types.product_search_service.ListProductSetsResponse]], request: google.cloud.vision_v1.types.product_search_service.ListProductSetsRequest, response: google.cloud.vision_v1.types.product_search_service.ListProductSetsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_product_sets
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListProductSetsResponse
object, and provides an__aiter__
method to iterate through itsproduct_sets
field.If there are more pages, the
__aiter__
method will make additionalListProductSets
requests and continue to iterate through theproduct_sets
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListProductSetsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListProductSetsRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListProductSetsResponse) – The initial response object.
retry (google.api_core.retry.AsyncRetry) – 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.
- class google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager(method: Callable[[...], google.cloud.vision_v1.types.product_search_service.ListProductSetsResponse], request: google.cloud.vision_v1.types.product_search_service.ListProductSetsRequest, response: google.cloud.vision_v1.types.product_search_service.ListProductSetsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_product_sets
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListProductSetsResponse
object, and provides an__iter__
method to iterate through itsproduct_sets
field.If there are more pages, the
__iter__
method will make additionalListProductSets
requests and continue to iterate through theproduct_sets
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListProductSetsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListProductSetsRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListProductSetsResponse) – The initial response object.
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.
- class google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager(method: Callable[[...], Awaitable[google.cloud.vision_v1.types.product_search_service.ListProductsResponse]], request: google.cloud.vision_v1.types.product_search_service.ListProductsRequest, response: google.cloud.vision_v1.types.product_search_service.ListProductsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_products
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListProductsResponse
object, and provides an__aiter__
method to iterate through itsproducts
field.If there are more pages, the
__aiter__
method will make additionalListProducts
requests and continue to iterate through theproducts
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListProductsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListProductsRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListProductsResponse) – The initial response object.
retry (google.api_core.retry.AsyncRetry) – 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.
- class google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager(method: Callable[[...], Awaitable[google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetResponse]], request: google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetRequest, response: google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_products_in_product_set
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListProductsInProductSetResponse
object, and provides an__aiter__
method to iterate through itsproducts
field.If there are more pages, the
__aiter__
method will make additionalListProductsInProductSet
requests and continue to iterate through theproducts
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListProductsInProductSetResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListProductsInProductSetRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListProductsInProductSetResponse) – The initial response object.
retry (google.api_core.retry.AsyncRetry) – 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.
- class google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager(method: Callable[[...], google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetResponse], request: google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetRequest, response: google.cloud.vision_v1.types.product_search_service.ListProductsInProductSetResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_products_in_product_set
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListProductsInProductSetResponse
object, and provides an__iter__
method to iterate through itsproducts
field.If there are more pages, the
__iter__
method will make additionalListProductsInProductSet
requests and continue to iterate through theproducts
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListProductsInProductSetResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListProductsInProductSetRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListProductsInProductSetResponse) – The initial response object.
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.
- class google.cloud.vision_v1.services.product_search.pagers.ListProductsPager(method: Callable[[...], google.cloud.vision_v1.types.product_search_service.ListProductsResponse], request: google.cloud.vision_v1.types.product_search_service.ListProductsRequest, response: google.cloud.vision_v1.types.product_search_service.ListProductsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_products
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListProductsResponse
object, and provides an__iter__
method to iterate through itsproducts
field.If there are more pages, the
__iter__
method will make additionalListProducts
requests and continue to iterate through theproducts
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListProductsResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListProductsRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListProductsResponse) – The initial response object.
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.
- class google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager(method: Callable[[...], Awaitable[google.cloud.vision_v1.types.product_search_service.ListReferenceImagesResponse]], request: google.cloud.vision_v1.types.product_search_service.ListReferenceImagesRequest, response: google.cloud.vision_v1.types.product_search_service.ListReferenceImagesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_reference_images
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListReferenceImagesResponse
object, and provides an__aiter__
method to iterate through itsreference_images
field.If there are more pages, the
__aiter__
method will make additionalListReferenceImages
requests and continue to iterate through thereference_images
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListReferenceImagesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiates the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListReferenceImagesRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListReferenceImagesResponse) – The initial response object.
retry (google.api_core.retry.AsyncRetry) – 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.
- class google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager(method: Callable[[...], google.cloud.vision_v1.types.product_search_service.ListReferenceImagesResponse], request: google.cloud.vision_v1.types.product_search_service.ListReferenceImagesRequest, response: google.cloud.vision_v1.types.product_search_service.ListReferenceImagesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]¶
A pager for iterating through
list_reference_images
requests.This class thinly wraps an initial
google.cloud.vision_v1.types.ListReferenceImagesResponse
object, and provides an__iter__
method to iterate through itsreference_images
field.If there are more pages, the
__iter__
method will make additionalListReferenceImages
requests and continue to iterate through thereference_images
field on the corresponding responses.All the usual
google.cloud.vision_v1.types.ListReferenceImagesResponse
attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.Instantiate the pager.
- Parameters
method (Callable) – The method that was originally called, and which instantiated this pager.
request (google.cloud.vision_v1.types.ListReferenceImagesRequest) – The initial request object.
response (google.cloud.vision_v1.types.ListReferenceImagesResponse) – The initial response object.
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.