Eliminare un processore
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Elimina un processore
Per saperne di più
Per la documentazione dettagliata che include questo esempio di codice, vedi quanto segue:
Esempio di codice
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis content provides a Python code sample for deleting a processor in Google Cloud's Document AI.\u003c/p\u003e\n"],["\u003cp\u003eThe code requires setting up Application Default Credentials for authentication and specifies project ID, location, and processor ID variables.\u003c/p\u003e\n"],["\u003cp\u003eThe code utilizes the Document AI Python API to delete a processor via its resource name, and handles \u003ccode\u003eNotFound\u003c/code\u003e exceptions.\u003c/p\u003e\n"],["\u003cp\u003eThe content references the Google Cloud sample browser for exploring further code samples and the Document AI Python API reference for detailed documentation.\u003c/p\u003e\n"]]],[],null,["Deletes a processor\n\nExplore further\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Creating and managing processors](/document-ai/docs/create-processor)\n\nCode sample \n\nPython\n\n\nFor more information, see the\n[Document AI Python API\nreference documentation](/python/docs/reference/documentai/latest).\n\n\nTo authenticate to Document AI, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n from google.api_core.client_options import ClientOptions\n from google.api_core.exceptions import NotFound\n from google.cloud import documentai # type: ignore\n\n # TODO(developer): Uncomment these variables before running the sample.\n # project_id = 'YOUR_PROJECT_ID'\n # location = 'YOUR_PROCESSOR_LOCATION' # Format is 'us' or 'eu'\n # processor_id = 'YOUR_PROCESSOR_ID'\n\n\n def delete_processor_sample(project_id: str, location: str, processor_id: str) -\u003e None:\n # You must set the api_endpoint if you use a location other than 'us'.\n opts = ClientOptions(api_endpoint=f\"{location}-documentai.googleapis.com\")\n\n client = documentai.https://cloud.google.com/python/docs/reference/documentai/latest/google.cloud.documentai_v1.services.document_processor_service.DocumentProcessorServiceClient.html(client_options=opts)\n\n # The full resource name of the processor\n # e.g.: projects/project_id/locations/location/processors/processor_id\n processor_name = client.https://cloud.google.com/python/docs/reference/documentai/latest/google.cloud.documentai_v1.services.document_processor_service.DocumentProcessorServiceClient.html#google_cloud_documentai_v1_services_document_processor_service_DocumentProcessorServiceClient_processor_path(project_id, location, processor_id)\n\n # Delete a processor\n try:\n operation = client.https://cloud.google.com/python/docs/reference/documentai/latest/google.cloud.documentai_v1.services.document_processor_service.DocumentProcessorServiceClient.html#google_cloud_documentai_v1_services_document_processor_service_DocumentProcessorServiceClient_delete_processor(name=processor_name)\n # Print operation details\n print(operation.operation.name)\n # Wait for operation to complete\n operation.result()\n except NotFound as e:\n print(e.message)\n\nWhat's next\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=documentai)."]]