決済代行業者のリストを取得する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
プロジェクトとロケーションにある既存のプロセッサを一覧表示します。
もっと見る
このコードサンプルを含む詳細なドキュメントについては、以下をご覧ください。
コードサンプル
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis content demonstrates how to list existing Document AI processors within a specified project and location using the Python API.\u003c/p\u003e\n"],["\u003cp\u003eThe code sample requires setting up Application Default Credentials for authentication and configuring the API endpoint based on the chosen location.\u003c/p\u003e\n"],["\u003cp\u003eThe script utilizes the \u003ccode\u003eDocumentProcessorServiceClient\u003c/code\u003e to fetch a list of processors associated with the given project and location.\u003c/p\u003e\n"],["\u003cp\u003eThe script iterates through the retrieved processor list and prints each processor's name, display name, and type to the console.\u003c/p\u003e\n"],["\u003cp\u003eThe sample code references further documentation for creating and managing processors as well as the Google Cloud sample browser for related codes.\u003c/p\u003e\n"]]],[],null,["# Get a list of processors\n\nList existing processors in a project and location.\n\nExplore further\n---------------\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-----------\n\n### Python\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.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\n\n def list_processors_sample(project_id: str, location: 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 location\n # e.g.: projects/project_id/locations/location\n parent = 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_common_location_path(project_id, location)\n\n # Make ListProcessors request\n processor_list = 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_list_processors(parent=parent)\n\n # Print the processor information\n for processor in processor_list:\n print(f\"Processor Name: {processor.name}\")\n print(f\"Processor Display Name: {processor.display_name}\")\n print(f\"Processor Type: {processor.type_}\")\n print(\"\")\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=documentai)."]]