airflow.contrib.hooks.gcp_vision_hook

Module Contents

class airflow.contrib.hooks.gcp_vision_hook.NameDeterminer(label, id_label, get_path)[source]

Class used for checking if the entity has the ‘name’ attribute set.

  • If so, no action is taken.

  • If not, and the name can be constructed from other parameters provided, it is created and filled in the entity.

  • If both the entity’s ‘name’ attribute is set and the name can be constructed from other parameters provided:

    • If they are the same - no action is taken

    • if they are different - an exception is thrown.

get_entity_with_name(self, entity, entity_id, location, project_id)[source]
_raise_ex_unable_to_determine_name(self)[source]
_raise_ex_different_names(self, constructed_name, explicit_name)[source]
class airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook(gcp_conn_id='google_cloud_default', delegate_to=None)[source]

Bases:airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook

Hook for Google Cloud Vision APIs.

_client[source]
product_name_determiner[source]
product_set_name_determiner[source]
get_conn(self)[source]

Retrieves connection to Cloud Vision.

Returns

Google Cloud Vision client object.

Return type

google.cloud.vision_v1.ProductSearchClient

annotator_client(self)[source]
create_product_set(self, location, product_set, project_id=None, product_set_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductSetCreateOperator

get_product_set(self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductSetGetOperator

update_product_set(self, product_set, location=None, product_set_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductSetUpdateOperator

delete_product_set(self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductSetDeleteOperator

create_product(self, location, product, project_id=None, product_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductCreateOperator

get_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductGetOperator

update_product(self, product, location=None, product_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductUpdateOperator

delete_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionProductDeleteOperator

create_reference_image(self, location, product_id, reference_image, reference_image_id=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionReferenceImageCreateOperator

delete_reference_image(self, location, product_id, reference_image_id, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionReferenceImageCreateOperator

add_product_to_product_set(self, product_set_id, product_id, location=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionAddProductToProductSetOperator

remove_product_from_product_set(self, product_set_id, product_id, location=None, project_id=None, retry=None, timeout=None, metadata=None)[source]

For the documentation see: CloudVisionRemoveProductFromProductSetOperator

annotate_image(self, request, retry=None, timeout=None)[source]

For the documentation see: CloudVisionAnnotateImage

static _get_autogenerated_id(response)[source]