Class ProductSearchAsyncClient (3.4.1)

Stay organized with collections Save and categorize content based on your preferences.
ProductSearchAsyncClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Union[str, google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport] = 'grpc_asyncio', client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

Manages Products and ProductSets of reference images for use in product search. It uses the following resource model:

  • The API has a collection of ProductSet resources, named projects/*/locations/*/productSets/*, which acts as a way to put different products into groups to limit identification.

In parallel,

  • The API has a collection of Product resources, named projects/*/locations/*/products/*

  • Each Product has a collection of ReferenceImage resources, named projects/*/locations/*/products/*/referenceImages/*

Properties

transport

Returns the transport used by the client instance.

Returns
TypeDescription
ProductSearchTransportThe transport used by the client instance.

Methods

ProductSearchAsyncClient

ProductSearchAsyncClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Union[str, google.cloud.vision_v1.services.product_search.transports.base.ProductSearchTransport] = 'grpc_asyncio', client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

Instantiates the product search client.

Parameters
NameDescription
credentials Optional[google.auth.credentials.Credentials]

The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

transport Union[str, .ProductSearchTransport]

The transport to use. If set to None, a transport is chosen automatically.

client_options ClientOptions

Custom options for the client. It won't take effect if a transport instance is provided. (1) The api_endpoint property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT environment variable can also be used to override the endpoint: "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). However, the api_endpoint property takes precedence if provided. (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is "true", then the client_cert_source property can be used to provide client certificate for mutual TLS 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.

Exceptions
TypeDescription
google.auth.exceptions.MutualTlsChannelErrorIf mutual TLS transport creation failed for any reason.

add_product_to_product_set

add_product_to_product_set(request: Optional[Union[google.cloud.vision_v1.types.product_search_service.AddProductToProductSetRequest, dict]] = None, *, name: Optional[str] = None, product: Optional[str] = None, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Union[float, object] = <_MethodDefault._DEFAULT_VALUE: <object object>>, metadata: Sequence[Tuple[str, str]] = ())

Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

One Product can be added to at most 100 ProductSets.

Possible errors:

  • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import vision_v1

async def sample_add_product_to_product_set():
    # Create a client
    client = vision_v1.ProductSearchAsyncClient()

    # Initialize request argument(s)
    request = vision_v1.AddProductToProductSetRequest(
        name="name_value",
        product="product_value",
    )

    # Make the request
    await client.add_product_to_product_set(request=request)
Parameters
NameDescription
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 the request instance; if request 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 the request instance; if request 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.

common_billing_account_path

common_billing_account_path(billing_account: str)

Returns a fully-qualified billing_account string.

common_folder_path

common_folder_path(folder: str)