How to decode a Google App Engine entity Key path str in Python?

后端 未结 2 1145
梦谈多话
梦谈多话 2021-01-03 00:15

In Google App Engine, an entity has a Key. A key can be made from a path, in which case str(key) is an opaque hex string. Example:

from google.appengine.ex         


        
2条回答
  •  心在旅途
    2021-01-03 01:11

    Once you have the Key object (which can be created by passing that opaque identifier to the constructor), use Key.to_path() to get the path of a Key as a list. For example:

    from google.appengine.ext import db
    opaque_id = 'agNiYXpyDAsSA2ZvbyIDYmFyDA'
    path = db.Key(opaque_id).to_path()
    

提交回复
热议问题