问题描述
我使用Google AppEngine端点来构建Web API。
我将用一个用Python编写的客户端来使用它。
我知道提供脚本来生成Android和iOS客户端API,但似乎并没有任何可比的Python。
看起来确实如此重复编码一切。例如,消息定义基本上是相同的。
无论如何,这样做更容易吗?
感谢您可以使用,它与端点兼容。
通常情况下,您会使用 为使用您的端点库,您可以使用: 然后,您可以使用 I am using Google AppEngine Endpoints to build a web API.I will consume it with a client written in Python.I know that scripts are provided to generate Android and iOS client API, but it doesn't seem that there is anything comparable for Python. It does seem redundant to code everything again. For instance, the messages definition which are basically the same. It there anyway of getting this done more easily? Thanks You can use the Google APIs Client Library for Python which is compatible with endpoints. Normally you would build a client using For using the library for your endpoint you would use: You can then access your API with 这篇关于使用Python客户端来使用GAE端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! service = build(api,version,http = http)
例如 service = build(plus,v1,http = http)$ c
$ b $ 创建一个客户端以访问Google+ API。 b
service = build(your_api,your_api_version,http = http,
discoveryServiceUrl =(https://yourapp.appspot.com/_ah/api / discovery / v1 /
apis / {api} / {apiVersion} / rest))
result = serv ice.resource()。method([parameters])。execute()
service = build(api, version, http=http)
for example service = build("plus", "v1", http=http)
to build a client to access to Google+ API.service = build("your_api", "your_api_version", http=http,
discoveryServiceUrl=("https://yourapp.appspot.com/_ah/api/discovery/v1/"
"apis/{api}/{apiVersion}/rest"))
result = service.resource().method([parameters]).execute()