This page describes how 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.
To create iOS clients for your API, we recommend that you use Google APIs Objective-C Client Library for REST APIs.
Before you begin
- Download the Endpoints Frameworks library and tools into your app directory as described in Getting started with Endpoints Frameworks.
- Make sure you have properly decorated your API code with the expected frameworks code.
Generating the client library
To generate a client library:
Change directory to the directory containing your API
app.yamlfile and API classes.
Invoke the Endpoints command line tool similar to the following:
python lib/endpoints/endpointscfg.py get_client_lib java -bs gradle main.EchoApi
mainis the class containing your API and
EchoApiis your API name.
Wait for the tool to generate the library; on success the tool displays a message similar to this one:
API client library written to ./echo-v1.zip
Unzip the file using the unzip utility, or use another ZIP-compatible unarchiving utility:
Build the client library:
The output is in the
build/libsdirectory. The exact filename depends on the version of the client. It will be something like
Add the client library JAR to your app.
Repeat the above steps every time you modify your API code.
Accessing backend APIs from Python clients
For information and sample code showing how to access a backend API from a Python client, see Accessing Backend APIs from Python Clients.