Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Esta página descreve como gerar uma biblioteca de cliente a partir de sua API de back-end do Python (o código executado no servidor). Qualquer aplicativo para Java ou Android pode usar essa biblioteca para chamar a API.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[[["\u003cp\u003eThis guide explains how to generate a Java client library from a Python backend API, which enables Java and Android applications to interact with the API.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves using the Endpoints Frameworks command-line tool to create a Gradle client bundle from your API code, using the class and name of your API.\u003c/p\u003e\n"],["\u003cp\u003eOnce the client library is generated as a ZIP file, it must be unzipped, built using Gradle, and the resulting JAR file added to the Java or Android application.\u003c/p\u003e\n"],["\u003cp\u003eIt is important to repeat the library generation process whenever modifications are made to the backend API code to ensure the client library remains in sync with the server code.\u003c/p\u003e\n"],["\u003cp\u003eFor generating iOS clients for your API, Google APIs Objective-C Client Library for REST APIs is recommended, it is also possible to access backend API from a Python client.\u003c/p\u003e\n"]]],[],null,["# Generating a client library\n\nThis page describes how to generate a client library from your Python backend\nAPI (the code that runs on the server). Any Java or Android app can use this\nlibrary to call the API.\n\nTo create iOS clients for your API, we recommend that you use\n[Google APIs Objective-C Client Library for REST APIs](https://github.com/google/google-api-objectivec-client-for-rest/wiki).\n\nBefore you begin\n----------------\n\n- Download the Cloud Endpoints Frameworks library and tools into your app directory as described in [Getting started with Endpoints Frameworks](/endpoints/docs/frameworks/python/quickstart-frameworks-python).\n- Make sure you have properly [decorated](/endpoints/docs/frameworks/python/create_api) your API code with the expected frameworks code.\n\nGenerating the client library\n-----------------------------\n\nThe following instructions demonstrate how to use the\nEndpoints Frameworks\n[command-line\ntool](/endpoints/docs/frameworks/python/endpoints_tool) to generate a Gradle client bundle from the sample code from\n[Getting started with Cloud Endpoints](/endpoints/docs/frameworks/python/quickstart-frameworks-python).\n\nTo generate a client library:\n\n1. Change directory to the directory containing your API `app.yaml` file and\n API classes.\n\n2. Run the Endpoints command-line tool similar to the following:\n\n python 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.\n\n Wait for the tool to generate the library; on success the tool displays a\n message similar to this one: \n\n ```\n API client library written to ./echo-v1.zip\n ```\n3. Unzip the file using the unzip utility, or use another ZIP-compatible\n unarchiving utility:\n\n unzip ./echo-v1-java.zip\n\n4. Change directory:\n\n cd echo\n\n5. Build the client library:\n\n gradle build\n\n The output is in the `build/libs` directory. The exact filename depends\n on the version of the client. It is similar to\n `echo-v1-1.23.0-SNAPSHOT.jar`.\n6. Add the client library JAR to your app.\n\n7. Repeat these steps every time you modify your API code.\n\nWhat's next\n-----------\n\nFor information and sample code showing how to access a backend API from a\nPython client, see\n[Accessing backend APIs from Python clients](/endpoints/docs/frameworks/python/access_from_python)."]]