Maven:這個套裝組合包含一個 pom.xml 檔案,其中具有 Endpoints Frameworks 和 Google API 用戶端程式庫依附元件。readme.html 檔案針對不同類型的用戶端應用程式,詳述您必須在 pom.xml 檔案中新增哪些項目,以及如何使用 Maven 為您的 API 建構用戶端程式庫。
Gradle:這個套裝組合包含一個 build.gradle 檔案,其中具有 Endpoints Frameworks 和 Google API 用戶端程式庫依附元件。readme.html 檔案針對不同類型的用戶端應用程式,詳述您必須在 build.gradle 檔案中新增哪些項目,以及如何使用 Gradle 為您的 API 建構用戶端程式庫。
預設的用戶端套裝組合:這個套裝組合包含所有依附元件程式庫和系統產生的 source.jar 檔案,該檔案即為您在用戶端中用來呼叫 API 的 Java 程式庫。這個套裝組合可為您的用戶端提供所有 Google API 用戶端程式庫功能 (包括 OAuth)。readme.html 檔案列出了不同用戶端應用程式類型需要的 .jar 檔案,以及使用用戶端程式庫的其他詳細資料。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-18 (世界標準時間)。"],[[["\u003cp\u003eThe Endpoints Frameworks command-line tool generates client library bundles, including Maven, Gradle, and default, for Java or Android apps to interact with your Python backend API.\u003c/p\u003e\n"],["\u003cp\u003eThis tool automatically creates a Discovery document detailing your API's structure when generating a client library.\u003c/p\u003e\n"],["\u003cp\u003eTo generate a client library, navigate to the directory containing your API's \u003ccode\u003eapp.yaml\u003c/code\u003e and service classes, then use the \u003ccode\u003eendpointscfg.py get_client_lib\u003c/code\u003e command with the target language, options, and API class name.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify options such as \u003ccode\u003e--application\u003c/code\u003e, \u003ccode\u003e--build-system\u003c/code\u003e, \u003ccode\u003e--hostname\u003c/code\u003e, and \u003ccode\u003e--output\u003c/code\u003e to customize the client library generation process.\u003c/p\u003e\n"],["\u003cp\u003eThe command \u003ccode\u003eendpointscfg.py get_openapi_spec\u003c/code\u003e generates an OpenAPI document from your API, and it supports options like \u003ccode\u003e--application\u003c/code\u003e, \u003ccode\u003e--hostname\u003c/code\u003e, and \u003ccode\u003e--output\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Cloud Endpoints Frameworks for App Engine command-line tool\n\nThis page describes how to use the Endpoints Frameworks command-line tool to generate a client library from your Python backend API (the code that runs on the server). Any Java or Android app can use this library to call the API.\n\nYou can generate client library bundles that allow applications to access your\nAPI using the Endpoints Frameworks command-line tool. When you\ngenerate a client library, the Endpoints Frameworks command-line tool\nautomatically generates a\n[Discovery document](https://developers.google.com/discovery/v1/reference/apis)\nthat describes the surface of your API.\n\nThe Endpoints Frameworks command-line tool,`endpointscfg.py` is\navailable in the Endpoints Frameworks library. For information on\ninstalling the Endpoints Frameworks library using `pip`, see\n[Installing the Endpoints Frameworks library](/endpoints/docs/frameworks/python/get-started-frameworks-python#installing_the_endpoints_frameworks_library).\nNote that the following commands assume you have installed the\nEndpoints Frameworks library in a directory called `lib`. Additionally,\nthe instructions assume you have created your backend API. See the\n[Endpoints Frameworks for Python tutorial](/endpoints/docs/frameworks/python/get-started-frameworks-python)\nfor an example of using the Endpoints Frameworks command-line tool on\nsample code.\n\n\nGenerating a client library bundle from an API\n----------------------------------------------\n\nYou can use the Endpoints Frameworks command-line tool to generate the\nfollowing types of client bundles:\n\n- Maven: This bundle includes a `pom.xml` file with the\n Endpoints Frameworks and Google API Client Library dependencies.\n The `readme.html` file provides detailed information on what you need to add\n to your `pom.xml` file for different types of client\n applications and how to build a client library for your API using Maven.\n\n- Gradle: This bundle includes a `build.gradle` file with the\n Endpoints Frameworks and Google API Client Library dependencies.\n The `readme.html` file provides detailed information on what you need to add\n to your `build.gradle` file for different types of client applications and\n how to build a client library for your API using Gradle.\n\n- Default client bundle: This bundle contains all the dependency libraries and\n the generated `source.jar` file, which is the Java library that you use in\n your client to call your API. This bundle provides your client with all of\n the Google API Client Library capabilities, including OAuth. The\n `readme.html` file lists the `.jar` files that are required for different\n types of client applications and other details for using the client library.\n\nIf you are using the client library with an Android app, we recommend that you\nuse a Gradle client bundle.\n\n### Generating the client library\n\nTo generate the client library:\n\n1. Change directory to the directory containing your API's `app.yaml`\n file and API service classes. Alternatively, use the\n [`--application`](#options)\n option to specify some other location of your application directory.\n\n2. Invoke the Endpoints Frameworks command-line tool similar to the\n following:\n\n lib/endpoints/endpointscfg.py get_client_lib java -bs gradle main.EchoApi\n\n where `main` is the class containing your API and `EchoApi` is your API name.\n3. Wait for the tool to generate the client library; on success the tool displays a\n message similar to this one:\n\n API client library written to ./echo-v1.zip\n\n4. Add the client library JAR to your Android app.\n\n5. Repeat the preceding steps every time you modify your API code.\n\nThe client library bundle is written to the current directory unless you\nspecify some other output directory using the\n[`output`](#options)\noption.\n\n### Command-line syntax\n\nThe basic syntax is as follows: \n\n```\n/path-to/your-app/lib/endpointscfg.py get_client_lib TARGET_LANG OPTIONS CLASS_NAME\n```\n\nwhere:\n\n- \u003cvar translate=\"no\"\u003eTARGET_LANG\u003c/var\u003e specifies the type of client bundle you want to create. Currently, you are required to supply the value `java` (for Java clients such as Android).\n- \u003cvar translate=\"no\"\u003eOPTIONS\u003c/var\u003e, if supplied, is one or more items shown in the [Options table](#options)\n- \u003cvar translate=\"no\"\u003eCLASS_NAME\u003c/var\u003e is the fully qualified class name of your API.\n\n| **Note:** If your API is implemented from multiple classes, specify each of them separated by a space.\n\n### Options\n\nYou can use the following options:\n\n\n### Supported client platforms\n\nThe following platforms are supported in the client bundle produced by the\nEndpoints Frameworks command-line tool:\n\n- Java 7 and higher:\n- [Android](https://github.com/googleapis/google-api-java-client/wiki/Android) 1.6 and higher.\n- [App Engine](https://github.com/googleapis/google-api-java-client/wiki).\n\nGenerating an OpenAPI document from an API\n------------------------------------------\n\nThe `endpointscfg.py` tool provides a command to generate an OpenAPI document\nfrom an API backend. The command syntax is: \n\n lib/endpoints/endpointscfg.py get_openapi_spec\n [-h]\n [-a APPLICATION]\n [--hostname HOSTNAME]\n [-o OUTPUT]\n service [service ...]\n\n positional arguments:\n service Fully qualified service class name.\n\n optional arguments:\n -h, --help Show this help message and exit.\n -a APPLICATION, --application APPLICATION\n The path to the Python App Engine application.\n --hostname HOSTNAME Default application hostname, if none is specified for the API service.\n -o OUTPUT, --output OUTPUT\n The directory to store output files.\n --x-google-api-name Add the 'x-google-api-name' field to the generated OpenAPI document.\n\nFor example, using [the `echo` example](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard/endpoints-frameworks-v2/echo): \n\n $ lib/endpoints/endpointscfg.py get_openapi_spec --hostname=echo-example.appspot.com main.EchoApi\n OpenAPI spec written to ./echov1openapi.json"]]