| :mod:`airflow.contrib.hooks.gcp_vision_hook` |
| ============================================ |
| |
| .. py:module:: airflow.contrib.hooks.gcp_vision_hook |
| |
| |
| Module Contents |
| --------------- |
| |
| .. py:class:: NameDeterminer(label, id_label, get_path) |
| |
| 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. |
| |
| |
| .. method:: get_entity_with_name(self, entity, entity_id, location, project_id) |
| |
| |
| |
| |
| .. method:: _raise_ex_unable_to_determine_name(self) |
| |
| |
| |
| |
| .. method:: _raise_ex_different_names(self, constructed_name, explicit_name) |
| |
| |
| |
| |
| .. py:class:: CloudVisionHook(gcp_conn_id='google_cloud_default', delegate_to=None) |
| |
| Bases: :class:`airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook` |
| |
| Hook for Google Cloud Vision APIs. |
| |
| .. attribute:: _client |
| |
| |
| |
| |
| .. attribute:: product_name_determiner |
| |
| |
| |
| |
| .. attribute:: product_set_name_determiner |
| |
| |
| |
| |
| |
| .. method:: get_conn(self) |
| |
| Retrieves connection to Cloud Vision. |
| |
| :return: Google Cloud Vision client object. |
| :rtype: google.cloud.vision_v1.ProductSearchClient |
| |
| |
| |
| |
| .. method:: annotator_client(self) |
| |
| |
| |
| |
| .. staticmethod:: _check_for_error(response) |
| |
| |
| |
| |
| .. method:: create_product_set(self, location, product_set, project_id=None, product_set_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetCreateOperator` |
| |
| |
| |
| |
| .. method:: get_product_set(self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetGetOperator` |
| |
| |
| |
| |
| .. method:: update_product_set(self, product_set, location=None, product_set_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetUpdateOperator` |
| |
| |
| |
| |
| .. method:: delete_product_set(self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetDeleteOperator` |
| |
| |
| |
| |
| .. method:: create_product(self, location, product, project_id=None, product_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductCreateOperator` |
| |
| |
| |
| |
| .. method:: get_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductGetOperator` |
| |
| |
| |
| |
| .. method:: update_product(self, product, location=None, product_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductUpdateOperator` |
| |
| |
| |
| |
| .. method:: delete_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductDeleteOperator` |
| |
| |
| |
| |
| .. method:: create_reference_image(self, location, product_id, reference_image, reference_image_id=None, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionReferenceImageCreateOperator` |
| |
| |
| |
| |
| .. method:: delete_reference_image(self, location, product_id, reference_image_id, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionReferenceImageCreateOperator` |
| |
| |
| |
| |
| .. method:: add_product_to_product_set(self, product_set_id, product_id, location=None, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionAddProductToProductSetOperator` |
| |
| |
| |
| |
| .. method:: remove_product_from_product_set(self, product_set_id, product_id, location=None, project_id=None, retry=None, timeout=None, metadata=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionRemoveProductFromProductSetOperator` |
| |
| |
| |
| |
| .. method:: annotate_image(self, request, retry=None, timeout=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_image_annotator_operator.CloudVisionAnnotateImage` |
| |
| |
| |
| |
| .. method:: batch_annotate_images(self, requests, retry=None, timeout=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_image_annotator_operator.CloudVisionAnnotateImage` |
| |
| |
| |
| |
| .. method:: text_detection(self, image, max_results=None, retry=None, timeout=None, additional_properties=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionDetectTextOperator` |
| |
| |
| |
| |
| .. method:: document_text_detection(self, image, max_results=None, retry=None, timeout=None, additional_properties=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionDetectDocumentTextOperator` |
| |
| |
| |
| |
| .. method:: label_detection(self, image, max_results=None, retry=None, timeout=None, additional_properties=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionDetectImageLabelsOperator` |
| |
| |
| |
| |
| .. method:: safe_search_detection(self, image, max_results=None, retry=None, timeout=None, additional_properties=None) |
| |
| For the documentation see: |
| :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionDetectImageSafeSearchOperator` |
| |
| |
| |
| |
| .. staticmethod:: _get_autogenerated_id(response) |
| |
| |
| |
| |