Simple Access API (Developer Key) with Google Cloud Endpoint (Python)

不想你离开。 提交于 2019-11-27 22:31:29

Extra fields in your protorpc request object that aren't part of the definition are still stored with the request.

If you wanted to use a key field as a query parameter, you could access it via

request.get_unrecognized_field_info('key')

even if key is not a field in your message definition.

This is done in users_id_token.py (the Auth part of the endpoints library) to allow sending bearer_token or access_token as query parameters instead of as header values.

Unfortunately, the nice quota checking and other associated pieces that a "Simple API Access" key gives are not readily available. However, you could issue your own keys and manually check a key against your list and potentially check against quotas that you have defined.

caspertm

For those looking to use @bossylobster's answer in Java, use the the SO Answer here: Getting raw HTTP Data (Headers, Cookies, etc) in Google Cloud Endpoints

P.S. I tried to make this a comment in @bossylobster's answer, but I don't have the reputation to do that. Feel free to clean up this answer so that other's can follow the path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!