-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.py
37 lines (29 loc) · 1.03 KB
/
users.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import json
import webapp2
from google.appengine.api import users
class Users(webapp2.RequestHandler):
def get(self):
result_json = {}
user = users.get_current_user()
# TODO: Have the redirect URL actually be the URL you came from.
result_json['login_url'] = users.create_login_url('/')
result_json['logout_url'] = users.create_logout_url('/')
# TODO: Actually store the list of users in the datastore and let you
# add remove them and to have groups so that people can use this for different
# things (e.g. thanksgiving, christmas, wedding, etc).
result_json['list'] = [
'grammy pat',
]
if user:
result_json['current_user'] = user.email()
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(json.dumps(result_json))
app = webapp2.WSGIApplication([
('/users', Users),
])