user514310
user514310

Reputation:

How do i get user key(google app)

How do I get user key? I am trying like this

 user = User.get_by_auth_id('k')
 print user.key

Its displaying 1. But that key entity is very long. I am looking for ag5kZXZ......

enter image description here

Upvotes: 1

Views: 211

Answers (1)

aschmid00
aschmid00

Reputation: 7158

are you using google.appengine.ext.db or google.appengine.ext.ndb ?

if your are using the standard db module it should be

print str(user.key())

i think with ndb your could get it with:

print user.key.urlsafe()

Upvotes: 1

Related Questions