Search code examples
pythongoogle-app-enginegoogle-cloud-endpoints

How to build Google python API for cloud endpoint server?


I have my Google app engine project which has Cloud endpoints hosted. I would wish to make API calls to my Cloud endpoints using python client library.

It can easily achieved when the library is a Google library: Example:

from googleapiclient.discovery import build
service = build('compute', 'v1', http=http).instances()
response = service.insert(project=project_id, zone=zone, body=body).execute()

I wish to know if same library can be utilized to make API calls my custom endpoints?


Solution

  • Add discoveryServiceUrl='https://foo.appspot.com/_ah/api/discovery/v1/apis/{api}/{apiVersion}/rest' to your build method call. See the official documentation.

    However, you might want to use apitools instead.